From bc49b2d5ba9bb8871f2f08a919629f1f1ec5275a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 22 Mar 2019 15:50:23 -0700 Subject: [PATCH] add allowDownward, fixes #369 --- src/api/java/baritone/api/Settings.java | 7 +++++++ .../java/baritone/pathing/movement/CalculationContext.java | 2 ++ .../pathing/movement/movements/MovementDownward.java | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index c70d60de..b2d89fd8 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -121,6 +121,13 @@ public final class Settings { */ public final Setting allowDiagonalDescend = new Setting<>(false); + /** + * Allow mining the block directly beneath its feet + *

+ * Turn this off to force it to make more staircases and less shafts + */ + public final Setting allowDownward = new Setting<>(true); + /** * Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.) */ diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 6edb8953..4dda3283 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -60,6 +60,7 @@ public class CalculationContext { public final boolean allowJumpAt256; public final boolean assumeWalkOnWater; public final boolean allowDiagonalDescend; + public final boolean allowDownward; public final int maxFallHeightNoWater; public final int maxFallHeightBucket; public final double waterWalkSpeed; @@ -91,6 +92,7 @@ public class CalculationContext { this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value; this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value; this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.value; + this.allowDownward = Baritone.settings().allowDownward.value; this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.value; this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.value; int depth = EnchantmentHelper.getDepthStriderModifier(player); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDownward.java b/src/main/java/baritone/pathing/movement/movements/MovementDownward.java index 2bec8fcf..47ed9580 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDownward.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDownward.java @@ -48,6 +48,9 @@ public class MovementDownward extends Movement { } public static double cost(CalculationContext context, int x, int y, int z) { + if (!context.allowDownward) { + return COST_INF; + } if (!MovementHelper.canWalkOn(context.bsi, x, y - 2, z)) { return COST_INF; }