From b719da01a42199e1c6179ba8c048e003e856165c Mon Sep 17 00:00:00 2001 From: Radiane Date: Mon, 15 Sep 2025 23:27:09 +0200 Subject: [PATCH 1/2] feat: Add durability check to Excavator Added a new option to stop the module when the main hand tool's durability drops below 100 to prevent breaking. --- .../systems/modules/world/Excavator.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java index 34f48d4b1e..7162e964f1 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java @@ -11,6 +11,7 @@ import meteordevelopment.meteorclient.events.meteor.KeyEvent; import meteordevelopment.meteorclient.events.meteor.MouseButtonEvent; import meteordevelopment.meteorclient.events.render.Render3DEvent; +import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.renderer.ShapeMode; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; @@ -19,6 +20,7 @@ import meteordevelopment.meteorclient.utils.misc.input.KeyAction; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import meteordevelopment.orbit.EventHandler; +import net.minecraft.item.ItemStack; import net.minecraft.util.hit.BlockHitResult; import org.lwjgl.glfw.GLFW; @@ -50,6 +52,13 @@ public class Excavator extends Module { .build() ); + private final Setting disableLowDura = sgGeneral.add(new BoolSetting.Builder() + .name("disable-low-dura") + .description("Disable the module when your main hand tool has < 100 durability to prevent it from breaking.") + .defaultValue(false) + .build() + ); + // Rendering private final Setting shapeMode = sgRendering.add(new EnumSetting.Builder() .name("shape-mode") @@ -92,6 +101,23 @@ public void onDeactivate() { status = Status.SEL_START; } + @EventHandler + private void onTick(TickEvent.Post event) { + if (!disableLowDura.get()) return; + if (isToolLowDurability()) { + info("Tool durability is below 100, stopping Excavator to prevent breaking."); + toggle(); + } + } + + private boolean isToolLowDurability() { + ItemStack mainHandStack = mc.player.getMainHandStack(); + if (mainHandStack.isEmpty() || !mainHandStack.isDamageable()) { + return false; + } + return mainHandStack.getMaxDamage() - mainHandStack.getDamage() < 100; + } + @EventHandler private void onMouseButton(MouseButtonEvent event) { if (event.action != KeyAction.Press || !selectionBind.get().isPressed() || mc.currentScreen != null) { From f9d4b78c77da6dc99b8e81267e4e52a3c482dbf8 Mon Sep 17 00:00:00 2001 From: Radiane Date: Mon, 15 Sep 2025 22:40:55 +0000 Subject: [PATCH 2/2] Allowed Excavtor to be paused when other module pause baritone --- .../systems/modules/world/Excavator.java | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java index 7162e964f1..fe121020e7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Excavator.java @@ -16,6 +16,7 @@ import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.utils.misc.Keybind; import meteordevelopment.meteorclient.utils.misc.input.KeyAction; import meteordevelopment.meteorclient.utils.render.color.SettingColor; @@ -84,6 +85,7 @@ public class Excavator extends Module { private enum Status { SEL_START, SEL_END, + READY_TO_WORK, // New state WORKING } @@ -103,10 +105,17 @@ public void onDeactivate() { @EventHandler private void onTick(TickEvent.Post event) { - if (!disableLowDura.get()) return; - if (isToolLowDurability()) { - info("Tool durability is below 100, stopping Excavator to prevent breaking."); - toggle(); + if (disableLowDura.get()) { + if (isToolLowDurability()) { + info("Tool durability is below 100, stopping Excavator to prevent breaking."); + toggle(); + return; + } + } + + if (status == Status.READY_TO_WORK && !baritone.getBuilderProcess().isActive()) { + baritone.getBuilderProcess().clearArea(start, end); + status = Status.WORKING; } } @@ -145,12 +154,11 @@ private void selectCorners() { } } else if (status == Status.SEL_END) { end = BetterBlockPos.from(result.getBlockPos()); - status = Status.WORKING; + status = Status.READY_TO_WORK; if (logSelection.get()) { info("End corner set: (%d, %d, %d)".formatted(end.getX(), end.getY(), end.getZ())); } baritone.getSelectionManager().addSelection(start, end); - baritone.getBuilderProcess().clearArea(start, end); } } @@ -159,11 +167,15 @@ private void onRender3D(Render3DEvent event) { if (status == Status.SEL_START || status == Status.SEL_END) { if (!(mc.crosshairTarget instanceof BlockHitResult result)) return; event.renderer.box(result.getBlockPos(), sideColor.get(), lineColor.get(), shapeMode.get(), 0); - } else if (status == Status.WORKING && !baritone.getBuilderProcess().isActive()) { - if (keepActive.get()) { + } else if (status == Status.WORKING) { + if (!baritone.getBuilderProcess().isActive()) { baritone.getSelectionManager().removeSelection(baritone.getSelectionManager().getLastSelection()); - status = Status.SEL_START; - } else toggle(); + if (keepActive.get()) { + status = Status.SEL_START; + } else { + toggle(); + } + } } } -} +} \ No newline at end of file