Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable dont-break-tools end durability setting #39

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading