Skip to content

Commit f6ddb77

Browse files
refactor ToolProperty -> MaterialToolProperty and SimpleToolProperty -> ToolProperty
1 parent b7c6027 commit f6ddb77

22 files changed

+350
-349
lines changed

src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import gregtech.api.unification.material.Materials;
1010
import gregtech.api.unification.material.info.MaterialIconSet;
1111
import gregtech.api.unification.material.properties.DustProperty;
12+
import gregtech.api.unification.material.properties.MaterialToolProperty;
1213
import gregtech.api.unification.material.properties.PropertyKey;
13-
import gregtech.api.unification.material.properties.ToolProperty;
1414
import gregtech.api.unification.material.registry.MaterialRegistry;
1515
import gregtech.api.unification.ore.OrePrefix;
1616
import gregtech.api.unification.stack.UnificationEntry;
@@ -235,7 +235,7 @@ public int getItemBurnTime(@NotNull ItemStack itemStack) {
235235
public boolean isBeaconPayment(@NotNull ItemStack stack) {
236236
Material material = getMaterial(stack);
237237
if (material != null && this.prefix != OrePrefix.ingot && this.prefix != OrePrefix.gem) {
238-
ToolProperty property = material.getProperty(PropertyKey.TOOL);
238+
MaterialToolProperty property = material.getProperty(PropertyKey.TOOL);
239239
return property != null && property.getToolHarvestLevel() >= 2;
240240
}
241241
return false;

src/main/java/gregtech/api/items/toolitem/IGTTool.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import gregtech.api.unification.material.Material;
1717
import gregtech.api.unification.material.Materials;
1818
import gregtech.api.unification.material.properties.DustProperty;
19+
import gregtech.api.unification.material.properties.MaterialToolProperty;
1920
import gregtech.api.unification.material.properties.PropertyKey;
20-
import gregtech.api.unification.material.properties.SimpleToolProperty;
2121
import gregtech.api.unification.material.properties.ToolProperty;
2222
import gregtech.api.unification.ore.OrePrefix;
2323
import gregtech.api.unification.stack.UnificationEntry;
@@ -183,7 +183,7 @@ default ItemStack get(Material material) {
183183
AoESymmetrical aoeDefinition = getToolStats().getAoEDefinition(stack);
184184

185185
// Set other tool stats (durability)
186-
SimpleToolProperty finalToolProperty = getToolProperty(material);
186+
ToolProperty finalToolProperty = getToolProperty(material);
187187
// Durability formula we are working with:
188188
// Final Durability = (material durability * material durability multiplier) + (tool definition durability *
189189
// definition durability multiplier) - 1
@@ -269,22 +269,22 @@ default Material getToolMaterial(ItemStack stack) {
269269
}
270270

271271
@Nullable
272-
default SimpleToolProperty getToolProperty(Material material) {
273-
SimpleToolProperty finalToolProperty;
272+
default ToolProperty getToolProperty(Material material) {
273+
ToolProperty finalToolProperty;
274274
{
275-
ToolProperty toolProperty = material.getProperty(PropertyKey.TOOL);
275+
MaterialToolProperty materialToolProperty = material.getProperty(PropertyKey.TOOL);
276276
if (material.hasProperty(PropertyKey.EXTRATOOL)) {
277277
finalToolProperty = material.getProperty(PropertyKey.EXTRATOOL)
278-
.getOverriddenResult(this.getToolId(), toolProperty);
278+
.getOverriddenResult(this.getToolId(), materialToolProperty);
279279
} else {
280-
finalToolProperty = toolProperty;
280+
finalToolProperty = materialToolProperty;
281281
}
282282
}
283283
return finalToolProperty;
284284
}
285285

286286
@Nullable
287-
default SimpleToolProperty getToolProperty(ItemStack stack) {
287+
default ToolProperty getToolProperty(ItemStack stack) {
288288
return getToolProperty(getToolMaterial(stack));
289289
}
290290

@@ -294,32 +294,32 @@ default DustProperty getDustProperty(ItemStack stack) {
294294
}
295295

296296
default float getMaterialToolSpeed(ItemStack stack) {
297-
SimpleToolProperty toolProperty = getToolProperty(stack);
297+
ToolProperty toolProperty = getToolProperty(stack);
298298
return toolProperty == null ? 0F : toolProperty.getToolSpeed();
299299
}
300300

301301
default float getMaterialAttackDamage(ItemStack stack) {
302-
SimpleToolProperty toolProperty = getToolProperty(stack);
302+
ToolProperty toolProperty = getToolProperty(stack);
303303
return toolProperty == null ? 0F : toolProperty.getToolAttackDamage();
304304
}
305305

306306
default float getMaterialAttackSpeed(ItemStack stack) {
307-
SimpleToolProperty toolProperty = getToolProperty(stack);
307+
ToolProperty toolProperty = getToolProperty(stack);
308308
return toolProperty == null ? 0F : toolProperty.getToolAttackSpeed();
309309
}
310310

311311
default int getMaterialDurability(ItemStack stack) {
312-
SimpleToolProperty toolProperty = getToolProperty(stack);
312+
ToolProperty toolProperty = getToolProperty(stack);
313313
return toolProperty == null ? 0 : toolProperty.getToolDurability() * toolProperty.getDurabilityMultiplier();
314314
}
315315

316316
default int getMaterialEnchantability(ItemStack stack) {
317-
SimpleToolProperty toolProperty = getToolProperty(stack);
317+
ToolProperty toolProperty = getToolProperty(stack);
318318
return toolProperty == null ? 0 : toolProperty.getToolEnchantability();
319319
}
320320

321321
default int getMaterialHarvestLevel(ItemStack stack) {
322-
SimpleToolProperty toolProperty = getToolProperty(stack);
322+
ToolProperty toolProperty = getToolProperty(stack);
323323
return toolProperty == null ? 0 : toolProperty.getToolHarvestLevel();
324324
}
325325

@@ -886,7 +886,7 @@ default List<IToolBehavior> getBehaviors(ItemStack stack) {
886886
}
887887
}
888888

889-
SimpleToolProperty property = getToolProperty(stack);
889+
ToolProperty property = getToolProperty(stack);
890890
if (property == null) return false;
891891

892892
// Check for any special enchantments specified by the material of this Tool

src/main/java/gregtech/api/items/toolitem/ToolHelper.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import gregtech.api.recipes.RecipeMaps;
1111
import gregtech.api.unification.OreDictUnifier;
1212
import gregtech.api.unification.material.Material;
13+
import gregtech.api.unification.material.properties.MaterialToolProperty;
1314
import gregtech.api.unification.material.properties.PropertyKey;
14-
import gregtech.api.unification.material.properties.ToolProperty;
1515
import gregtech.api.unification.ore.OrePrefix;
1616
import gregtech.api.util.GTUtility;
1717
import gregtech.api.util.function.QuintFunction;
@@ -230,11 +230,11 @@ public static ItemStack getAndSetToolData(IGTTool tool, Material material, int m
230230
toolTag.setInteger(HARVEST_LEVEL_KEY, harvestLevel);
231231
toolTag.setFloat(TOOL_SPEED_KEY, toolSpeed);
232232
toolTag.setFloat(ATTACK_DAMAGE_KEY, attackDamage);
233-
ToolProperty toolProperty = material.getProperty(PropertyKey.TOOL);
234-
if (toolProperty != null) {
235-
toolProperty.getEnchantments().forEach((enchantment, level) -> {
233+
MaterialToolProperty materialToolProperty = material.getProperty(PropertyKey.TOOL);
234+
if (materialToolProperty != null) {
235+
materialToolProperty.getEnchantments().forEach((enchantment, level) -> {
236236
if (stack.getItem().canApplyAtEnchantingTable(stack, enchantment)) {
237-
stack.addEnchantment(enchantment, level.getLevel(toolProperty.getToolHarvestLevel()));
237+
stack.addEnchantment(enchantment, level.getLevel(materialToolProperty.getToolHarvestLevel()));
238238
}
239239
});
240240
}

src/main/java/gregtech/api/unification/material/Material.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import gregtech.api.unification.material.properties.IngotProperty;
2121
import gregtech.api.unification.material.properties.ItemPipeProperties;
2222
import gregtech.api.unification.material.properties.MaterialProperties;
23+
import gregtech.api.unification.material.properties.MaterialToolProperty;
2324
import gregtech.api.unification.material.properties.OreProperty;
2425
import gregtech.api.unification.material.properties.PolymerProperty;
2526
import gregtech.api.unification.material.properties.PropertyKey;
2627
import gregtech.api.unification.material.properties.RotorProperty;
27-
import gregtech.api.unification.material.properties.ToolProperty;
2828
import gregtech.api.unification.material.properties.WireProperties;
2929
import gregtech.api.unification.material.properties.WoodProperty;
3030
import gregtech.api.unification.material.registry.MaterialRegistry;
@@ -638,7 +638,7 @@ public Builder dust() {
638638
* Will be created with no Burn Time (Furnace Fuel).
639639
*
640640
* @param harvestLevel The Harvest Level of this block for Mining.<br>
641-
* If this Material also has a {@link ToolProperty}, this value will
641+
* If this Material also has a {@link MaterialToolProperty}, this value will
642642
* also be used to determine the tool's Mining Level.
643643
* @throws IllegalArgumentException If a {@link DustProperty} has already been added to this Material.
644644
*/
@@ -650,7 +650,7 @@ public Builder dust(int harvestLevel) {
650650
* Add a {@link DustProperty} to this Material.
651651
*
652652
* @param harvestLevel The Harvest Level of this block for Mining.<br>
653-
* If this Material also has a {@link ToolProperty}, this value will
653+
* If this Material also has a {@link MaterialToolProperty}, this value will
654654
* also be used to determine the tool's Mining Level.
655655
* @param burnTime The Burn Time (in ticks) of this Material as a Furnace Fuel.
656656
* @throws IllegalArgumentException If a {@link DustProperty} has already been added to this Material.
@@ -673,7 +673,7 @@ public Builder wood() {
673673
* Will be created with a Burn Time of 300 (Furnace Fuel).
674674
*
675675
* @param harvestLevel The Harvest Level of this block for Mining.<br>
676-
* If this Material also has a {@link ToolProperty}, this value will
676+
* If this Material also has a {@link MaterialToolProperty}, this value will
677677
* also be used to determine the tool's Mining Level.
678678
*/
679679
public Builder wood(int harvestLevel) {
@@ -684,7 +684,7 @@ public Builder wood(int harvestLevel) {
684684
* Add a {@link WoodProperty} to this Material.
685685
*
686686
* @param harvestLevel The Harvest Level of this block for Mining.<br>
687-
* If this Material also has a {@link ToolProperty}, this value will
687+
* If this Material also has a {@link MaterialToolProperty}, this value will
688688
* also be used to determine the tool's Mining Level.
689689
* @param burnTime The Burn Time (in ticks) of this Material as a Furnace Fuel.
690690
*/
@@ -712,7 +712,7 @@ public Builder ingot() {
712712
* Will automatically add a {@link DustProperty} to this Material if it does not already have one.
713713
*
714714
* @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.<br>
715-
* If this Material also has a {@link ToolProperty}, this value will
715+
* If this Material also has a {@link MaterialToolProperty}, this value will
716716
* also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest
717717
* diamonds.<br>
718718
* If this Material already had a Harvest Level defined, it will be overridden.
@@ -727,7 +727,7 @@ public Builder ingot(int harvestLevel) {
727727
* Will automatically add a {@link DustProperty} to this Material if it does not already have one.
728728
*
729729
* @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.<br>
730-
* If this Material also has a {@link ToolProperty}, this value will
730+
* If this Material also has a {@link MaterialToolProperty}, this value will
731731
* also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest
732732
* diamonds.<br>
733733
* If this Material already had a Harvest Level defined, it will be overridden.
@@ -764,7 +764,7 @@ public Builder gem() {
764764
* Will automatically add a {@link DustProperty} to this Material if it does not already have one.
765765
*
766766
* @param harvestLevel The Harvest Level of this block for Mining.<br>
767-
* If this Material also has a {@link ToolProperty}, this value will
767+
* If this Material also has a {@link MaterialToolProperty}, this value will
768768
* also be used to determine the tool's Mining level.<br>
769769
* If this Material already had a Harvest Level defined, it will be overridden.
770770
* @throws IllegalArgumentException If a {@link GemProperty} has already been added to this Material.
@@ -778,7 +778,7 @@ public Builder gem(int harvestLevel) {
778778
* Will automatically add a {@link DustProperty} to this Material if it does not already have one.
779779
*
780780
* @param harvestLevel The Harvest Level of this block for Mining.<br>
781-
* If this Material also has a {@link ToolProperty}, this value will
781+
* If this Material also has a {@link MaterialToolProperty}, this value will
782782
* also be used to determine the tool's Mining level.<br>
783783
* If this Material already had a Harvest Level defined, it will be overridden.
784784
* @param burnTime The Burn Time (in ticks) of this Material as a Furnace Fuel.<br>
@@ -813,7 +813,7 @@ public Builder polymer() {
813813
* Will have a burn time of 0
814814
*
815815
* @param harvestLevel The Harvest Level of this block for Mining.<br>
816-
* If this Material also has a {@link ToolProperty}, this value will
816+
* If this Material also has a {@link MaterialToolProperty}, this value will
817817
* also be used to determine the tool's Mining level.<br>
818818
* If this Material already had a Harvest Level defined, it will be overridden.
819819
* @throws IllegalArgumentException If an {@link PolymerProperty} has already been added to this Material.
@@ -930,10 +930,10 @@ public Builder element(Element element) {
930930

931931
/**
932932
* Replaced the old toolStats methods which took many parameters.
933-
* Use {@link ToolProperty.Builder} instead to create a Tool Property.
933+
* Use {@link MaterialToolProperty.Builder} instead to create a Tool Property.
934934
*/
935-
public Builder toolStats(ToolProperty toolProperty) {
936-
properties.setProperty(PropertyKey.TOOL, toolProperty);
935+
public Builder toolStats(MaterialToolProperty materialToolProperty) {
936+
properties.setProperty(PropertyKey.TOOL, materialToolProperty);
937937
return this;
938938
}
939939

src/main/java/gregtech/api/unification/material/materials/ElementMaterials.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import gregtech.api.unification.Elements;
77
import gregtech.api.unification.material.Material;
88
import gregtech.api.unification.material.properties.BlastProperty.GasTier;
9+
import gregtech.api.unification.material.properties.MaterialToolProperty;
910
import gregtech.api.unification.material.properties.PropertyKey;
10-
import gregtech.api.unification.material.properties.ToolProperty;
1111

1212
import static gregtech.api.GTValues.*;
1313
import static gregtech.api.unification.material.Materials.*;
@@ -31,7 +31,7 @@ public static void register() {
3131
.flags(EXT2_METAL, GENERATE_GEAR, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_SPRING,
3232
GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_DOUBLE_PLATE)
3333
.element(Elements.Al)
34-
.toolStats(ToolProperty.Builder.of(6.0F, 7.5F, 768, 2)
34+
.toolStats(MaterialToolProperty.Builder.of(6.0F, 7.5F, 768, 2)
3535
.enchantability(14).build())
3636
.rotorStats(10.0f, 2.0f, 128)
3737
.cableProperties(V[EV], 1, 1)
@@ -386,7 +386,7 @@ public static void register() {
386386
GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES,
387387
BLAST_FURNACE_CALCITE_TRIPLE)
388388
.element(Elements.Fe)
389-
.toolStats(ToolProperty.Builder.of(2.0F, 2.0F, 256, 2)
389+
.toolStats(MaterialToolProperty.Builder.of(2.0F, 2.0F, 256, 2)
390390
.enchantability(14).build())
391391
.rotorStats(7.0f, 2.5f, 256)
392392
.cableProperties(V[MV], 2, 3)
@@ -833,7 +833,7 @@ public static void register() {
833833
.flags(EXT2_METAL, GENERATE_DOUBLE_PLATE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR,
834834
GENERATE_FRAME)
835835
.element(Elements.Ti)
836-
.toolStats(ToolProperty.Builder.of(8.0F, 6.0F, 1536, 3)
836+
.toolStats(MaterialToolProperty.Builder.of(8.0F, 6.0F, 1536, 3)
837837
.enchantability(14).build())
838838
.rotorStats(7.0f, 3.0f, 1600)
839839
.fluidPipeProperties(2426, 150, true, true, false, false)
@@ -970,7 +970,7 @@ public static void register() {
970970
.flags(EXT_METAL, GENERATE_BOLT_SCREW, GENERATE_FRAME, GENERATE_GEAR, GENERATE_LONG_ROD,
971971
GENERATE_DOUBLE_PLATE)
972972
.element(Elements.Nt)
973-
.toolStats(ToolProperty.Builder.of(180.0F, 100.0F, 65535, 6)
973+
.toolStats(MaterialToolProperty.Builder.of(180.0F, 100.0F, 65535, 6)
974974
.attackSpeed(0.5F).enchantability(33).magnetic().unbreakable().build())
975975
.rotorStats(24.0f, 12.0f, 655360)
976976
.fluidPipeProperties(100_000, 5000, true, true, true, true)
@@ -993,7 +993,7 @@ public static void register() {
993993
.color(0x4BAFAF).iconSet(BRIGHT)
994994
.flags(EXT_METAL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_DOUBLE_PLATE)
995995
.element(Elements.Dr)
996-
.toolStats(ToolProperty.Builder.of(14.0F, 12.0F, 8192, 5)
996+
.toolStats(MaterialToolProperty.Builder.of(14.0F, 12.0F, 8192, 5)
997997
.attackSpeed(0.3F).enchantability(33).magnetic().build())
998998
.fluidPipeProperties(9625, 500, true, true, true, true)
999999
.build();

0 commit comments

Comments
 (0)