From 83fd01cd021d2442559e65037cc040629d5d82c7 Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Mon, 30 Dec 2024 12:50:21 +1100 Subject: [PATCH] Fixed tool repair values and made configurable. --- src/main/java/vswe/stevescarts/SCConfig.java | 41 +++++++++++++++++-- .../workers/tools/ModuleDrillDiamond.java | 4 +- .../workers/tools/ModuleDrillHardened.java | 4 +- .../workers/tools/ModuleDrillIron.java | 4 +- .../workers/tools/ModuleFarmerDiamond.java | 4 +- .../tools/ModuleWoodcutterDiamond.java | 4 +- .../tools/ModuleWoodcutterHardened.java | 4 +- .../tools/ModuleWoodcutterNetherite.java | 8 ++-- 8 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/main/java/vswe/stevescarts/SCConfig.java b/src/main/java/vswe/stevescarts/SCConfig.java index a28a5b41..63f1cf31 100644 --- a/src/main/java/vswe/stevescarts/SCConfig.java +++ b/src/main/java/vswe/stevescarts/SCConfig.java @@ -1,7 +1,5 @@ package vswe.stevescarts; -import com.electronwill.nightconfig.core.file.CommentedFileConfig; -import com.electronwill.nightconfig.core.io.WritingMode; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.Logging; import net.neoforged.fml.event.config.ModConfigEvent; @@ -9,8 +7,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; -import java.nio.file.Path; - public class SCConfig { public static final String CATEGORY_GENERAL = "general"; @@ -37,14 +33,29 @@ public static class Common { public final ModConfigSpec.ConfigValue allowCartToRunWithRepairItems; public final ModConfigSpec.ConfigValue woodcutterRepairDiamond; + public final ModConfigSpec.ConfigValue woodcutterRepairAmountDiamond; + public final ModConfigSpec.ConfigValue woodcutterDurabilityDiamond; public final ModConfigSpec.ConfigValue woodcutterRepairHardened; + public final ModConfigSpec.ConfigValue woodcutterRepairAmountHardened; + public final ModConfigSpec.ConfigValue woodcutterDurabilityHardened; public final ModConfigSpec.ConfigValue woodcutterRepairNetherite; + public final ModConfigSpec.ConfigValue woodcutterRepairAmountNetherite; + public final ModConfigSpec.ConfigValue woodcutterDurabilityNetherite; public final ModConfigSpec.ConfigValue drillRepairIron; + public final ModConfigSpec.ConfigValue drillRepairAmountIron; + public final ModConfigSpec.ConfigValue drillDurabilityIron; public final ModConfigSpec.ConfigValue drillRepairDiamond; + public final ModConfigSpec.ConfigValue drillRepairAmountDiamond; + public final ModConfigSpec.ConfigValue drillDurabilityDiamond; public final ModConfigSpec.ConfigValue drillRepairHardened; + public final ModConfigSpec.ConfigValue drillRepairAmountHardened; + public final ModConfigSpec.ConfigValue drillDurabilityHardened; public final ModConfigSpec.ConfigValue farmerRepairDiamond; + public final ModConfigSpec.ConfigValue farmerRepairAmountDiamond; + public final ModConfigSpec.ConfigValue farmerDurabilityDiamond; + public final ModConfigSpec.ConfigValue assemblerInsertFuel; Common(ModConfigSpec.Builder builder) { @@ -59,15 +70,37 @@ public static class Common { compact_solar_production = builder.comment("The amount of power the compact solar module will produce").define("compactSolarProduction", 20); standard_solar_production = builder.comment("The amount of power the standard solar module will produce").define("standardSolarProduction", 20); + woodcutterRepairDiamond = builder.comment("Repair item for Diamond Woodcutter").define("woodcutterRepairDiamond", "minecraft:diamond"); + woodcutterRepairAmountDiamond = builder.comment("Repair value for Diamond Woodcutter repair item").define("woodcutterRepairAmountDiamond", 160000); + woodcutterDurabilityDiamond = builder.comment("Diamond Woodcutter max durability").define("woodcutterDurabilityDiamond", 320000); + woodcutterRepairHardened = builder.comment("Repair item for Hardened Woodcutter").define("woodcutterRepairHardened", "stevescarts:component_reinforced_metal"); + woodcutterRepairAmountHardened = builder.comment("Repair value for Hardened Woodcutter repair item").define("woodcutterRepairAmountHardened", 320000); + woodcutterDurabilityHardened = builder.comment("Hardened Woodcutter max durability").define("woodcutterDurabilityHardened", 640000); + woodcutterRepairNetherite = builder.comment("Repair item for Netherite Woodcutter").define("woodcutterRepairNetherite", "minecraft:netherite_ingot"); + woodcutterRepairAmountNetherite = builder.comment("Repair value for Netherite Woodcutter repair item").define("woodcutterRepairAmountNetherite", 450000); + woodcutterDurabilityNetherite = builder.comment("Netherite Woodcutter max durability").define("woodcutterDurabilityNetherite", 1000000); + drillRepairIron = builder.comment("Repair item for Iron Drill").define("drillRepairIron", "minecraft:iron_ingot"); + drillRepairAmountIron = builder.comment("Repair value for Iron Drill repair item").define("drillRepairAmountIron", 20000); + drillDurabilityIron = builder.comment("Iron Drill max durability").define("drillDurabilityIron", 50000); + drillRepairDiamond = builder.comment("Repair item for Diamond Drill").define("drillRepairDiamond", "minecraft:diamond"); + drillRepairAmountDiamond = builder.comment("Repair value for Diamond Drill repair item").define("drillRepairAmountDiamond", 100000); + drillDurabilityDiamond = builder.comment("Diamond Drill max durability").define("drillDurabilityDiamond", 300000); + drillRepairHardened = builder.comment("Repair item for Hardened Drill").define("drillRepairHardened", "stevescarts:component_reinforced_metal"); + drillRepairAmountHardened = builder.comment("Repair value for Hardened Drill repair item").define("drillRepairAmountHardened", 450000); + drillDurabilityHardened = builder.comment("Hardened Drill max durability").define("drillDurabilityHardened", 1000000); + farmerRepairDiamond = builder.comment("Repair item for Diamond farmer").define("farmerRepairDiamond", "minecraft:diamond"); + farmerRepairAmountDiamond = builder.comment("Repair value for Diamond farmer repair item").define("farmerRepairAmountDiamond", 150000); + farmerDurabilityDiamond = builder.comment("Diamond farmer max durability").define("farmerDurabilityDiamond", 300000); + allowCartToRunWithRepairItems = builder.comment("Allow carts to run with items in the tool repair slot").define("allowCartToRunWithRepairItems", false); assemblerInsertFuel = builder.comment("Allow fuel to be auto inserted into the cart assembler").define("assemblerInsertFuel", false); diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillDiamond.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillDiamond.java index 2adcc736..ec5ce834 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillDiamond.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillDiamond.java @@ -35,7 +35,7 @@ protected float getTimeMult() @Override public int getMaxDurability() { - return 300000; + return SCConfig.COMMON.drillDurabilityDiamond.get(); } @Override @@ -47,7 +47,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 100000; + return SCConfig.COMMON.drillRepairAmountDiamond.get(); } return 0; } diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillHardened.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillHardened.java index 9678407d..6482ffff 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillHardened.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillHardened.java @@ -35,7 +35,7 @@ protected float getTimeMult() @Override public int getMaxDurability() { - return 320000*3; + return SCConfig.COMMON.drillDurabilityHardened.get(); } @Override @@ -47,7 +47,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 320000; + return SCConfig.COMMON.drillRepairAmountHardened.get(); } return 0; } diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillIron.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillIron.java index 21d5251d..d8f6b9fa 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillIron.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleDrillIron.java @@ -35,7 +35,7 @@ protected float getTimeMult() @Override public int getMaxDurability() { - return 50000; + return SCConfig.COMMON.drillDurabilityIron.get(); } @Override @@ -47,7 +47,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 20000; + return SCConfig.COMMON.drillRepairAmountIron.get(); } return 0; } diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleFarmerDiamond.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleFarmerDiamond.java index a9b42ad7..84afb5ba 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleFarmerDiamond.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleFarmerDiamond.java @@ -17,7 +17,7 @@ public ModuleFarmerDiamond(final EntityMinecartModular cart) @Override public int getMaxDurability() { - return 300000; + return SCConfig.COMMON.farmerDurabilityDiamond.get(); } @Override @@ -29,7 +29,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 150000; + return SCConfig.COMMON.farmerRepairAmountDiamond.get(); } return 0; } diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterDiamond.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterDiamond.java index 850befcb..7c13186a 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterDiamond.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterDiamond.java @@ -23,7 +23,7 @@ public int getPercentageDropChance() @Override public int getMaxDurability() { - return 320000; + return SCConfig.COMMON.woodcutterDurabilityDiamond.get(); } @Override @@ -35,7 +35,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 16000; + return SCConfig.COMMON.woodcutterRepairAmountDiamond.get(); } return 0; } diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterHardened.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterHardened.java index 86b4526b..8ae51a9c 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterHardened.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterHardened.java @@ -23,7 +23,7 @@ public int getPercentageDropChance() @Override public int getMaxDurability() { - return 640000; + return SCConfig.COMMON.woodcutterDurabilityHardened.get(); } @Override @@ -35,7 +35,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 320000; + return SCConfig.COMMON.woodcutterRepairAmountHardened.get(); } return 0; } diff --git a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterNetherite.java b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterNetherite.java index 628694d9..0d676dea 100644 --- a/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterNetherite.java +++ b/src/main/java/vswe/stevescarts/modules/workers/tools/ModuleWoodcutterNetherite.java @@ -17,13 +17,13 @@ public ModuleWoodcutterNetherite(final EntityMinecartModular cart) @Override public int getPercentageDropChance() { - return 80; + return 90; } @Override public int getMaxDurability() { - return 320000; + return SCConfig.COMMON.woodcutterDurabilityNetherite.get(); } @Override @@ -35,7 +35,7 @@ public ResourceLocation getRepairItem() { @Override public int getRepairItemUnits(@NotNull ItemStack stack) { if (BuiltInRegistries.ITEM.getKey(stack.getItem()).equals(getRepairItem())) { - return 160000; + return SCConfig.COMMON.woodcutterRepairAmountNetherite.get(); } return 0; } @@ -43,6 +43,6 @@ public int getRepairItemUnits(@NotNull ItemStack stack) { @Override public int getRepairSpeed() { - return 150; + return 250; } }