From 07eee481cbd5427f4dbe3c753de7dab91f45d593 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 1 Oct 2018 15:42:16 -0700 Subject: [PATCH] fix failure on repeated descend --- .../java/baritone/pathing/path/PathExecutor.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index d73cd9ad..523b98b0 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -111,7 +111,7 @@ public class PathExecutor implements Helper { for (int j = pathPosition; j <= previousPos; j++) { path.movements().get(j).reset(); } - clearKeys(); + onChangeInPathPosition(); return false; } } @@ -122,7 +122,7 @@ public class PathExecutor implements Helper { } System.out.println("Double skip sundae"); pathPosition = i - 1; - clearKeys(); + onChangeInPathPosition(); return false; } } @@ -251,8 +251,7 @@ public class PathExecutor implements Helper { if (movementStatus == SUCCESS) { //System.out.println("Movement done, next path"); pathPosition++; - ticksOnCurrent = 0; - clearKeys(); + onChangeInPathPosition(); onTick(event); return true; } else { @@ -328,13 +327,14 @@ public class PathExecutor implements Helper { player().setSprinting(true); } pathPosition++; + // okay to skip clearKeys and / or onChangeInPathPosition here since this isn't possible to repeat, since it's asymmetric logDebug("Skipping descend to straight ascend"); return; } if (canSprintInto(current, next)) { if (playerFeet().equals(current.getDest())) { pathPosition++; - clearKeys(); + onChangeInPathPosition(); } if (!player().isSprinting()) { player().setSprinting(true); @@ -376,6 +376,11 @@ public class PathExecutor implements Helper { return false; } + private void onChangeInPathPosition() { + clearKeys(); + ticksOnCurrent = 0; + } + private static void clearKeys() { // i'm just sick and tired of this snippet being everywhere lol Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();