Skip to content

Commit

Permalink
Configurable dont-break-tools end durability setting (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickcat325 authored Oct 28, 2024
1 parent f50c777 commit 7662ef9
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ public class HighwayBuilderHIG extends Module {
.build()
);

private final Setting<Integer> endDurability = sgDigging.add(new IntSetting.Builder()
.name("end-durability")
.description("What durability do you want your tools to end up at?")
.defaultValue(3)
.range(1, 2031)
.sliderRange(1, 100)
.visible(() -> dontBreakTools.get())
.build()
);

private final Setting<Integer> savePickaxes = sgDigging.add(new IntSetting.Builder()
.name("save-pickaxes")
.description("How many pickaxes to ensure are saved.")
Expand Down Expand Up @@ -1121,7 +1131,7 @@ protected int findAndMoveBestToolToHotbar(HighwayBuilderHIG b, BlockState blockS
for (int i = 0; i < b.mc.player.getInventory().main.size(); i++) {
double score = AutoTool.getScore(b.mc.player.getInventory().getStack(i), blockState, false, false, AutoTool.EnchantPreference.None, itemStack -> {
if (noSilkTouch && Utils.hasEnchantment(itemStack, Enchantments.SILK_TOUCH)) return false;
return !b.dontBreakTools.get() || itemStack.getMaxDamage() - itemStack.getDamage() > 1;
return !b.dontBreakTools.get() || itemStack.getMaxDamage() - itemStack.getDamage() > b.endDurability.get();
});

if (score > bestScore) {
Expand Down

0 comments on commit 7662ef9

Please sign in to comment.