From 2741fc2683be6f49edbd4fdfdfce6ab5d3593217 Mon Sep 17 00:00:00 2001 From: Echocage Date: Mon, 27 Jun 2022 15:06:27 -0500 Subject: [PATCH 1/3] Swapped the order of checks within canSprintFromDescendInto --- src/main/java/baritone/pathing/path/PathExecutor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 7e4f76a3..0ff113df 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -536,12 +536,12 @@ public class PathExecutor implements IPathExecutor, Helper { } private static boolean canSprintFromDescendInto(IPlayerContext ctx, IMovement current, IMovement next) { - if (next instanceof MovementDescend && next.getDirection().equals(current.getDirection())) { - return true; - } if (!MovementHelper.canWalkOn(ctx, current.getDest().add(current.getDirection()))) { return false; } + if (next instanceof MovementDescend && next.getDirection().equals(current.getDirection())) { + return true; + } if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection())) { return true; } From 57c4f9e1033cad41353c4bc74cee158d2041025a Mon Sep 17 00:00:00 2001 From: Echocage Date: Mon, 27 Jun 2022 18:38:54 -0500 Subject: [PATCH 2/3] Undid previous change, updated to instead check the next and the next_next block --- src/main/java/baritone/pathing/path/PathExecutor.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 0ff113df..0ff7a3ac 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -385,7 +385,7 @@ public class PathExecutor implements IPathExecutor, Helper { return false; } - if (pathPosition < path.length() - 2) { + if (pathPosition < path.length() - 3) { IMovement next = path.movements().get(pathPosition + 1); if (next instanceof MovementAscend && current.getDirection().up().equals(next.getDirection().down())) { // a descend then an ascend in the same direction @@ -396,7 +396,8 @@ public class PathExecutor implements IPathExecutor, Helper { logDebug("Skipping descend to straight ascend"); return true; } - if (canSprintFromDescendInto(ctx, current, next)) { + if (canSprintFromDescendInto(ctx, current, next) && + canSprintFromDescendInto(ctx, next, path.movements().get(pathPosition + 2))) { if (ctx.playerFeet().equals(current.getDest())) { pathPosition++; onChangeInPathPosition(); @@ -536,12 +537,12 @@ public class PathExecutor implements IPathExecutor, Helper { } private static boolean canSprintFromDescendInto(IPlayerContext ctx, IMovement current, IMovement next) { - if (!MovementHelper.canWalkOn(ctx, current.getDest().add(current.getDirection()))) { - return false; - } if (next instanceof MovementDescend && next.getDirection().equals(current.getDirection())) { return true; } + if (!MovementHelper.canWalkOn(ctx, current.getDest().add(current.getDirection()))) { + return false; + } if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection())) { return true; } From 441dceb73174cfc376eaf455ba5673b3679a8102 Mon Sep 17 00:00:00 2001 From: Echocage Date: Wed, 29 Jun 2022 17:54:28 -0500 Subject: [PATCH 3/3] Narrowed scope and we now only call canSprintFromDescendInto when our next & next_next movements are both MovementDescends --- .../baritone/pathing/path/PathExecutor.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 0ff7a3ac..17fa788d 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -73,8 +73,8 @@ public class PathExecutor implements IPathExecutor, Helper { private HashSet toPlace = new HashSet<>(); private HashSet toWalkInto = new HashSet<>(); - private PathingBehavior behavior; - private IPlayerContext ctx; + private final PathingBehavior behavior; + private final IPlayerContext ctx; private boolean sprintNextTick; @@ -385,7 +385,7 @@ public class PathExecutor implements IPathExecutor, Helper { return false; } - if (pathPosition < path.length() - 3) { + if (pathPosition < path.length() - 2) { IMovement next = path.movements().get(pathPosition + 1); if (next instanceof MovementAscend && current.getDirection().up().equals(next.getDirection().down())) { // a descend then an ascend in the same direction @@ -396,13 +396,21 @@ public class PathExecutor implements IPathExecutor, Helper { logDebug("Skipping descend to straight ascend"); return true; } - if (canSprintFromDescendInto(ctx, current, next) && - canSprintFromDescendInto(ctx, next, path.movements().get(pathPosition + 2))) { + if (canSprintFromDescendInto(ctx, current, next)) { + + if (next instanceof MovementDescend && pathPosition < path.length() - 3) { + IMovement next_next = path.movements().get(pathPosition + 2); + if (next_next instanceof MovementDescend && !canSprintFromDescendInto(ctx, next, next_next)) { + return false; + } + + } if (ctx.playerFeet().equals(current.getDest())) { pathPosition++; onChangeInPathPosition(); onTick(); } + return true; } //logDebug("Turning off sprinting " + movement + " " + next + " " + movement.getDirection() + " " + next.getDirection().down() + " " + next.getDirection().down().equals(movement.getDirection()));