@@ -13,76 +13,78 @@ toolStats has the following arguments:
1313
1414` .toolStats(float harvestSpeed, float attackDamage, int durability, int harvestLevel, GTToolType[] types) `
1515
16- - ` harvestSpeed ` is how fast the tool actually breaks blocks in world.
17- - Takes a decimal number eg.(5.6).
18- - ` attackDamage ` is the amount of damage per hit you deal to mobs/players.
19- - Also takes a decimal number.
20- - ` durability ` is the number of times the tool can be used before it breaks.
21- - Takes a positive whole number up to 2.147 billion (e.g 700).
22- This applies to both crafting use and in-world use.
23- Crafting generally consumes 2 points of durability per use.
24- - ` harvestLevel ` is the tier of block it can break.
25- - Can take a number between 1-6 with 1 being wood, 6 being neutronium.
26- - ` GtToolType ` is a group of tools in an object.
27- - Must pass these as an array, using the [ ] notation.
28- This argument can be left out if you want it to apply to all tool types.
16+ - ` harvestSpeed: float ` is how fast the tool actually breaks blocks in world.
17+ - ` attackDamage: float ` is the amount of damage per hit you deal to mobs/players.
18+ - ` durability: int ` is the number of times the tool can be used before it breaks.
19+ - This applies to both crafting use and in-world use.
20+ Crafting generally consumes 2 points of durability per use.
21+ - ` harvestLevel: int ` is the tier of block it can break.
22+ - Can take an integer between 1-6 with 1 being wood, 6 being neutronium.
23+ - ` types: GTToolType[] ` is an array of tools in an object.
24+ - Must pass these as an array, using the [ ] notation.
25+ This argument can be left out if you want your material to apply to all tool types.
2926
30- An example of this being actually used is included below
27+ An example of this being used is included below
3128``` js title="example_tool_material.js"
3229GTCEuStartupEvents .registry (' gtceu:material' , event => {
3330 event .create (' aluminfrost' )
3431 .ingot ()
3532 .color (0xadd8e6 ).secondaryColor (0xc0c0c0 ).iconSet (GTMaterialIconSet .DULL )
36- .toolStats (new ToolProperty (12 , 7 , 3072 , 6 ,
33+ .toolStats (new ToolProperty (12.0 , 7.0 , 3072 , 6 ,
3734 [
3835 GTToolType .DRILL_LV ,
3936 GTToolType .MINING_HAMMER
4037 ]
4138 ))
4239});
4340```
44- You can also add further arguments onto your tools such as:
41+ Using the ToolProperties.Builder, you can also add further arguments onto your tools.
42+ The builder has the same arguments as the constructor, and can have chained methods such as:
43+
4544- ` .unbreakable() `
46- - Makes electric tools bypass durability effectively making them never break.
45+ - Makes electric tools bypass durability effectively making them never break.
4746- ` .magnetic() `
48- - Makes mined blocks and mob drops teleport to player inventory.
49- - ` attackSpeed(float) `
50- - Set the attack speed of a tool made from this Material (animation time).
51- Takes a decimal number.
47+ - Makes mined blocks and mob drops teleport to player inventory.
48+ - ` attackSpeed(float attackSpeed) `
49+ - Set the attack speed of a tool made from this Material (animation time).
5250- ` ignoreCraftingTools() `
53- - Disable crafting tools being made from this Material.
54- - ` addEnchantmentForTools(enchantment, level) `
55- - Enchantment is the default enchantment applied on tool creation.
56- Level is the level of said enchantment.
51+ - Disable crafting tools being made from this Material.
52+
53+ - ` addEnchantmentForTools(Enchantment enchantment, int level) `
54+ - Enchantment is the default enchantment applied on tool creation.
55+ Level is the level of said enchantment.
5756- ` enchantability(int enchantability) `
58- - Set the base enchantability of a tool made from this Material.
59- Iron is 14, Diamond is 10, Stone is 5.
60- Takes a whole number.
57+ - Set the base enchantability of a tool made from this Material.
58+ Iron is 14, Diamond is 10, Stone is 5.
6159
62- Here is an example of using them in your material:
60+ Here is an example of using the builder in a material:
6361``` js title="example_tool_material.js"
6462GTCEuStartupEvents .registry (' gtceu:material' , event => {
6563 event .create (' aluminfrost' )
6664 .ingot ()
6765 .color (0xadd8e6 ).secondaryColor (0xc0c0c0 ).iconSet (GTMaterialIconSet .DULL )
68- .toolStats ($ToolProperty .Builder .of (1.8 , 1.7 , 700 , 3 ,
69- [GTToolType .SWORD ,
70- GTToolType .PICKAXE ,
71- GTToolType .SHOVEL ,
72- ])
73- .unbreakable ()
74- .addEnchantmentForTools (silk_touch, 1 )
75- .build ())
66+ .toolStats (
67+ $ToolProperty .Builder .of (1.8 , 1.7 , 700 , 3 ,
68+ [
69+ GTToolType .SWORD ,
70+ GTToolType .PICKAXE ,
71+ GTToolType .SHOVEL ,
72+ ]
73+ )
74+ .unbreakable ()
75+ .addEnchantmentForTools (silk_touch, 1 )
76+ .build ()
77+ )
7678});
7779```
7880
79- You can also add more tool types to a GT material that already has a tool property. You do, however, have to remove the current tool property as it is immutable (not changeable) .
81+ You can also change the tool property of a GT material that already has a tool property. You do, however, have to remove the current tool property as it is immutable.
8082``` js title="tool_replacement.js"
8183GTCEuStartupEvents .materialModification (event => {
8284 if (GTMaterials .Iron .hasProperty ($PropertyKey .TOOL )) {
8385 GTMaterials .Iron .removeProperty ($PropertyKey .TOOL );
8486 }
85- GTMaterials .Neutronium .setProperty ($PropertyKey .TOOL ,
87+ GTMaterials .Iron .setProperty ($PropertyKey .TOOL ,
8688 $ToolProperty .Builder .of (180 , 5.9 , 2147483647 , 6 ,
8789 [
8890 GTToolType .SOFT_MALLET ,
@@ -92,37 +94,38 @@ GTCEuStartupEvents.materialModification(event => {
9294});
9395```
9496Here is a list of all the GtToolTypes
95- - SWORD,
96- - PICKAXE,
97- - SHOVEL,
98- - AXE,
99- - HOE,
100- - MINING_HAMMER,
101- - SPADE,
102- - SAW,
103- - HARD_HAMMER,
104- - SOFT_MALLET,
105- - WRENCH,
106- - FILE,
107- - CROWBAR,
108- - SCREWDRIVER,
109- - MORTAR,
110- - WIRE_CUTTER,
111- - SCYTHE,
112- - KNIFE,
113- - BUTCHERY_KNIFE,
114- - PLUNGER,
115- - DRILL_LV,
116- - DRILL_MV,
117- - DRILL_HV,
118- - DRILL_EV,
119- - DRILL_IV,
120- - CHAINSAW_LV,
121- - WRENCH_LV,
122- - WRENCH_HV,
123- - WRENCH_IV,
124- - BUZZSAW,
125- - SCREWDRIVER_LV,
126- - WIRE_CUTTER_LV,
127- - WIRE_CUTTER_HV,
128- - WIRE_CUTTER_IV,
97+
98+ - SWORD
99+ - PICKAXE
100+ - SHOVEL
101+ - AXE
102+ - HOE
103+ - MINING_HAMMER
104+ - SPADE
105+ - SAW
106+ - HARD_HAMMER
107+ - SOFT_MALLET
108+ - WRENCH
109+ - FILE
110+ - CROWBAR
111+ - SCREWDRIVER
112+ - MORTAR
113+ - WIRE_CUTTER
114+ - SCYTHE
115+ - KNIFE
116+ - BUTCHERY_KNIFE
117+ - PLUNGER
118+ - DRILL_LV
119+ - DRILL_MV
120+ - DRILL_HV
121+ - DRILL_EV
122+ - DRILL_IV
123+ - CHAINSAW_LV
124+ - WRENCH_LV
125+ - WRENCH_HV
126+ - WRENCH_IV
127+ - BUZZSAW
128+ - SCREWDRIVER_LV
129+ - WIRE_CUTTER_LV
130+ - WIRE_CUTTER_HV
131+ - WIRE_CUTTER_IV
0 commit comments