Skip to content

Commit

Permalink
Fixed tool repair values and made configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon3055 committed Dec 30, 2024
1 parent 5f0b48b commit 83fd01c
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 20 deletions.
41 changes: 37 additions & 4 deletions src/main/java/vswe/stevescarts/SCConfig.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
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;
import net.neoforged.neoforge.common.ModConfigSpec;
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";

Expand All @@ -37,14 +33,29 @@ public static class Common {
public final ModConfigSpec.ConfigValue<Boolean> allowCartToRunWithRepairItems;

public final ModConfigSpec.ConfigValue<String> woodcutterRepairDiamond;
public final ModConfigSpec.ConfigValue<Integer> woodcutterRepairAmountDiamond;
public final ModConfigSpec.ConfigValue<Integer> woodcutterDurabilityDiamond;
public final ModConfigSpec.ConfigValue<String> woodcutterRepairHardened;
public final ModConfigSpec.ConfigValue<Integer> woodcutterRepairAmountHardened;
public final ModConfigSpec.ConfigValue<Integer> woodcutterDurabilityHardened;
public final ModConfigSpec.ConfigValue<String> woodcutterRepairNetherite;
public final ModConfigSpec.ConfigValue<Integer> woodcutterRepairAmountNetherite;
public final ModConfigSpec.ConfigValue<Integer> woodcutterDurabilityNetherite;

public final ModConfigSpec.ConfigValue<String> drillRepairIron;
public final ModConfigSpec.ConfigValue<Integer> drillRepairAmountIron;
public final ModConfigSpec.ConfigValue<Integer> drillDurabilityIron;
public final ModConfigSpec.ConfigValue<String> drillRepairDiamond;
public final ModConfigSpec.ConfigValue<Integer> drillRepairAmountDiamond;
public final ModConfigSpec.ConfigValue<Integer> drillDurabilityDiamond;
public final ModConfigSpec.ConfigValue<String> drillRepairHardened;
public final ModConfigSpec.ConfigValue<Integer> drillRepairAmountHardened;
public final ModConfigSpec.ConfigValue<Integer> drillDurabilityHardened;

public final ModConfigSpec.ConfigValue<String> farmerRepairDiamond;
public final ModConfigSpec.ConfigValue<Integer> farmerRepairAmountDiamond;
public final ModConfigSpec.ConfigValue<Integer> farmerDurabilityDiamond;

public final ModConfigSpec.ConfigValue<Boolean> assemblerInsertFuel;

Common(ModConfigSpec.Builder builder) {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected float getTimeMult()
@Override
public int getMaxDurability()
{
return 300000;
return SCConfig.COMMON.drillDurabilityDiamond.get();
}

@Override
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected float getTimeMult()
@Override
public int getMaxDurability()
{
return 320000*3;
return SCConfig.COMMON.drillDurabilityHardened.get();
}

@Override
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected float getTimeMult()
@Override
public int getMaxDurability()
{
return 50000;
return SCConfig.COMMON.drillDurabilityIron.get();
}

@Override
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ModuleFarmerDiamond(final EntityMinecartModular cart)
@Override
public int getMaxDurability()
{
return 300000;
return SCConfig.COMMON.farmerDurabilityDiamond.get();
}

@Override
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public int getPercentageDropChance()
@Override
public int getMaxDurability()
{
return 320000;
return SCConfig.COMMON.woodcutterDurabilityDiamond.get();
}

@Override
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public int getPercentageDropChance()
@Override
public int getMaxDurability()
{
return 640000;
return SCConfig.COMMON.woodcutterDurabilityHardened.get();
}

@Override
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,14 +35,14 @@ 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;
}

@Override
public int getRepairSpeed()
{
return 150;
return 250;
}
}

0 comments on commit 83fd01c

Please sign in to comment.