From 8a4f48f08d8059190122a9549ab1430e6cfa3ae1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 20 Dec 2018 21:06:56 -0800 Subject: [PATCH] diagonal descend option --- src/api/java/baritone/api/Settings.java | 13 ++++++++++--- .../pathing/movement/CalculationContext.java | 6 ++++++ .../movement/movements/MovementDiagonal.java | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 59d6c217..9df80d2f 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -111,6 +111,15 @@ public class Settings { */ public Setting allowJumpAt256 = new Setting<>(false); + /** + * Allow descending diagonally + *

+ * Safer than allowParkour yet still slightly unsafe, can make contact with unchecked adjacent blocks, so it's unsafe in the nether. + *

+ * For a generic "take some risks" mode I'd turn on this one, parkour, and parkour place. + */ + public Setting allowDiagonalDescend = new Setting<>(false); + /** * Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.) */ @@ -163,10 +172,8 @@ public class Settings { * metric gets better and better with each block, instead of slightly worse. *

* Finding the optimal path is worth it, so it's the default. - *

- * This value is an expression instead of a literal so that it's exactly equal to SPRINT_ONE_BLOCK_COST defined in ActionCosts.java */ - public Setting costHeuristic = new Setting<>(20 / 5.612); + public Setting costHeuristic = new Setting<>(3.563); // a bunch of obscure internal A* settings that you probably don't want to change /** diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 5d6fe81b..e2485be7 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -57,6 +57,7 @@ public class CalculationContext { private final boolean allowParkourPlace; private final boolean allowJumpAt256; private final boolean assumeWalkOnWater; + private final boolean allowDiagonalDescend; private final int maxFallHeightNoWater; private final int maxFallHeightBucket; private final double waterWalkSpeed; @@ -86,6 +87,7 @@ public class CalculationContext { this.allowParkourPlace = Baritone.settings().allowParkourPlace.get(); this.allowJumpAt256 = Baritone.settings().allowJumpAt256.get(); this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.get(); + this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.get(); this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.get(); this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.get(); int depth = EnchantmentHelper.getDepthStriderModifier(player); @@ -201,6 +203,10 @@ public class CalculationContext { return assumeWalkOnWater; } + public boolean allowDiagonalDescend() { + return allowDiagonalDescend; + } + public int maxFallHeightNoWater() { return maxFallHeightNoWater; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 2b1e77af..3145f253 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -72,7 +72,7 @@ public class MovementDiagonal extends Movement { boolean descend = false; if (!MovementHelper.canWalkOn(context.bsi(), destX, y - 1, destZ, destWalkOn)) { descend = true; - if (!MovementHelper.canWalkOn(context.bsi(), destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context.bsi(), destX, y - 1, destZ, destWalkOn)) { + if (!context.allowDiagonalDescend() || !MovementHelper.canWalkOn(context.bsi(), destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context.bsi(), destX, y - 1, destZ, destWalkOn)) { return; } }