fix failure on repeated descend

This commit is contained in:
Leijurv 2018-10-01 15:42:16 -07:00
parent 8f146d1a2b
commit 07eee481cb
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -111,7 +111,7 @@ public class PathExecutor implements Helper {
for (int j = pathPosition; j <= previousPos; j++) { for (int j = pathPosition; j <= previousPos; j++) {
path.movements().get(j).reset(); path.movements().get(j).reset();
} }
clearKeys(); onChangeInPathPosition();
return false; return false;
} }
} }
@ -122,7 +122,7 @@ public class PathExecutor implements Helper {
} }
System.out.println("Double skip sundae"); System.out.println("Double skip sundae");
pathPosition = i - 1; pathPosition = i - 1;
clearKeys(); onChangeInPathPosition();
return false; return false;
} }
} }
@ -251,8 +251,7 @@ public class PathExecutor implements Helper {
if (movementStatus == SUCCESS) { if (movementStatus == SUCCESS) {
//System.out.println("Movement done, next path"); //System.out.println("Movement done, next path");
pathPosition++; pathPosition++;
ticksOnCurrent = 0; onChangeInPathPosition();
clearKeys();
onTick(event); onTick(event);
return true; return true;
} else { } else {
@ -328,13 +327,14 @@ public class PathExecutor implements Helper {
player().setSprinting(true); player().setSprinting(true);
} }
pathPosition++; 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"); logDebug("Skipping descend to straight ascend");
return; return;
} }
if (canSprintInto(current, next)) { if (canSprintInto(current, next)) {
if (playerFeet().equals(current.getDest())) { if (playerFeet().equals(current.getDest())) {
pathPosition++; pathPosition++;
clearKeys(); onChangeInPathPosition();
} }
if (!player().isSprinting()) { if (!player().isSprinting()) {
player().setSprinting(true); player().setSprinting(true);
@ -376,6 +376,11 @@ public class PathExecutor implements Helper {
return false; return false;
} }
private void onChangeInPathPosition() {
clearKeys();
ticksOnCurrent = 0;
}
private static void clearKeys() { private static void clearKeys() {
// i'm just sick and tired of this snippet being everywhere lol // i'm just sick and tired of this snippet being everywhere lol
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();