From a38da64c4900e57b64b8774f766eed44a35134a1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 09:05:29 -0700 Subject: [PATCH] make the left click workaround optional --- src/main/java/baritone/Settings.java | 8 +++++++ .../baritone/pathing/movement/Movement.java | 21 ++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index fddb7bce..895f76a4 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -314,6 +314,14 @@ public class Settings { */ public Setting prefix = new Setting<>(false); + /** + * true: can mine blocks when in inventory, chat, or tabbed away in ESC menu + * false: works on cosmic prisons + *

+ * LOL + */ + public Setting leftClickWorkaround = new Setting<>(true); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 5aaf1be1..b574a91b 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -119,18 +119,19 @@ public abstract class Movement implements Helper, MovementHelper { this.didBreakLastTick = false; latestState.getInputStates().forEach((input, forced) -> { - RayTraceResult trace = mc.objectMouseOver; - boolean isBlockTrace = trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK; - boolean isLeftClick = forced && input == Input.CLICK_LEFT; + if (Baritone.settings().leftClickWorkaround.get()) { + RayTraceResult trace = mc.objectMouseOver; + boolean isBlockTrace = trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK; + boolean isLeftClick = forced && input == Input.CLICK_LEFT; - // If we're forcing left click, we're in a gui screen, and we're looking - // at a block, break the block without a direct game input manipulation. - if (mc.currentScreen != null && isLeftClick && isBlockTrace) { - BlockBreakHelper.tryBreakBlock(trace.getBlockPos(), trace.sideHit); - this.didBreakLastTick = true; - return; + // If we're forcing left click, we're in a gui screen, and we're looking + // at a block, break the block without a direct game input manipulation. + if (mc.currentScreen != null && isLeftClick && isBlockTrace) { + BlockBreakHelper.tryBreakBlock(trace.getBlockPos(), trace.sideHit); + this.didBreakLastTick = true; + return; + } } - Baritone.INSTANCE.getInputOverrideHandler().setInputForceState(input, forced); }); latestState.getInputStates().replaceAll((input, forced) -> false);