Skip to content

Commit 029fa24

Browse files
Tool Property Page for the Wiki (#3827)
Co-authored-by: Jurre Groenendijk <jurre@jilles.com>
1 parent c8a86b4 commit 029fa24

File tree

2 files changed

+141
-2
lines changed

2 files changed

+141
-2
lines changed

docs/content/Modpacks/Materials-and-Elements/01-Material-Creation.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,21 @@ You can change the properties of the material by adding any combination of the f
2323
- `.iconSet(set)` gives the material an icon set.
2424
- `.color(int colorCode)` gives the material a color. The color must be provided as a hex value in the following form: `0xNNNNNN`, where `N` are digits.
2525
- `.secondaryColor(int colorCode)` gives the material a secondary color. If this is not being called, the secondary value will default to white(0xffffff).
26+
- The secondary color is the overlay over the primary color on the material. This can be seen in the dust of a material, as the secondary color outline is visible. Rotors are another solid example.
2627
- `.flags(flag1, flag2, ...)` can be used to select certain properties of the material, like generating gears, or disabling decomposition.
28+
Examples of use can be found in [Material Flags](https://gregtechceu.github.io/GregTech-Modern/Modpacks/Materials-and-Elements/Material-Flags/)
2729
- `.element(element)` -> similar to `.components()`, but is used when the material represents an element.
28-
- `.rotorStats(speed, damage, durability)` -> this will create a turbine rotor from this material.
30+
- `.rotorStats(/* int */ power, /* int */ efficiency, /* float */ damage, /* int */ durability)` -> this will create a turbine rotor from this material
31+
1. Power is the EU/t and fuel consumption multiplier the turbine gets when equipped with this rotor.
32+
This output varies depending on speed of turbine and rotor holder.
33+
2. Efficiency is how well it handles fuel.
34+
A smaller number will make it consume more fuel while a bigger number means it uses less fuel.
35+
Actual efficiency: rotorEfficiency * holder Efficiency / 100
36+
3. Damage is the amount of damage that happens to the player when opening the ui of a running turbine's rotor holder.
37+
4. Durability is how much base durability it has.
38+
- Here are some examples of base gt rotors:
39+
1. Titanium Rotor: .rotorStats(130, 115, 3.0, 1600)
40+
2. HSS-S Rotor .rotorStats(250, 180, 7.0, 3000)
2941
- `.blastTemp()` is meant to be paired together with `.ingot()`. Will generate a EBF recipe (and an ABS recipe) based on the parameters you give it:
3042
1. temperature -> dictates what coil tier it will require (check the coil tooltips for their max temperature).
3143
If the temperature is below 1000, it will also generate a PBF recipe.
@@ -51,7 +63,6 @@ You can change the properties of the material by adding any combination of the f
5163
1. Voltage, amperage, loss per block
5264
2. Voltage, amperage, loss per block, is superconductor -> for a super conductor, set loss as 0 and is super conductor as true
5365
3. Voltage, amperage, loss per block, is super conductor, critical temperature
54-
- `.toolProperties()`
5566
- `.fluidPipeProperties()`
5667
- `.itemPipeProperties()`
5768
- `.addDefaultEnchant()`
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: Tool Creation
3+
---
4+
5+
Tools can be made out of materials you create by calling toolStats inside the material's code.
6+
7+
When working with tools you will need to load these classes at the top of your file.
8+
```js
9+
const $PropertyKey = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey');
10+
const $ToolProperty = Java.loadClass('com.gregtechceu.gtceu.api.data.chemical.material.properties.ToolProperty');
11+
```
12+
toolStats has the following arguments:
13+
14+
`.toolStats(float harvestSpeed, float attackDamage, int durability, int harvestLevel, GTToolType[] types)`
15+
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.
29+
30+
An example of this being actually used is included below
31+
```js title="example_tool_material.js"
32+
GTCEuStartupEvents.registry('gtceu:material', event => {
33+
event.create('aluminfrost')
34+
.ingot()
35+
.color(0xadd8e6).secondaryColor(0xc0c0c0).iconSet(GTMaterialIconSet.DULL)
36+
.toolStats(new ToolProperty(12, 7, 3072, 6,
37+
[
38+
GTToolType.DRILL_LV,
39+
GTToolType.MINING_HAMMER
40+
]
41+
))
42+
});
43+
```
44+
You can also add further arguments onto your tools such as:
45+
- `.unbreakable()`
46+
- Makes electric tools bypass durability effectively making them never break.
47+
- `.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.
52+
- `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.
57+
- `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.
61+
62+
Here is an example of using them in your material:
63+
```js title="example_tool_material.js"
64+
GTCEuStartupEvents.registry('gtceu:material', event => {
65+
event.create('aluminfrost')
66+
.ingot()
67+
.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())
76+
});
77+
```
78+
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).
80+
```js title="tool_replacement.js"
81+
GTCEuStartupEvents.materialModification(event => {
82+
if (GTMaterials.Iron.hasProperty($PropertyKey.TOOL)) {
83+
GTMaterials.Iron.removeProperty($PropertyKey.TOOL);
84+
}
85+
GTMaterials.Neutronium.setProperty($PropertyKey.TOOL,
86+
$ToolProperty.Builder.of(180, 5.9, 2147483647, 6,
87+
[
88+
GTToolType.SOFT_MALLET,
89+
GTToolType.DRILL_LV
90+
]
91+
).build());
92+
});
93+
```
94+
Here 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,

0 commit comments

Comments
 (0)