From 19355cb4f252489356e91a37bfac877055247ae3 Mon Sep 17 00:00:00 2001 From: RealIndrit Date: Fri, 14 Aug 2020 10:58:15 +0200 Subject: [PATCH] Added AutoToolMovement bypass setting for special usage cases, should not be used it not actually necessary --- src/api/java/baritone/api/Settings.java | 8 ++++++++ .../java/baritone/pathing/movement/MovementHelper.java | 4 +++- src/main/java/baritone/utils/ToolSet.java | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index c03b0b72..5b0d58ed 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -66,6 +66,14 @@ public final class Settings { */ public final Setting autoTool = new Setting<>(true); + /** + * Should movement cost calculation ignore the cost of breaking blocks with current slot? + * Only use this if actually necessary, make sure to put this back to original state (false), or it + * will mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any + * problems occurs) + */ + public final Setting ignoreAutoToolMovementCost = new Setting<>(false); + /** * It doesn't actually take twenty ticks to place a block, this cost is so high * because we want to generally conserve blocks which might be limited. diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 1a3faf57..7ae57ae4 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,7 +432,9 @@ public interface MovementHelper extends ActionCosts, Helper { * @param ts previously calculated ToolSet */ static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) { - ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); + if (Baritone.settings().autoTool.value) { + ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); + } } static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) { diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index cd347d20..2d8a1a2a 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -103,7 +103,7 @@ public class ToolSet { */ public int getBestSlot(Block b, boolean preferSilkTouch) { // Make all depending calculation respect auto tool value without doing unecessary calculations... - if (!Baritone.settings().autoTool.value) { + if (!Baritone.settings().ignoreAutoToolMovementCost.value) { return player.inventory.currentItem; }