Merge pull request #3533 from Echocage/SprintFix

Fix for a sprint bug that can cause death
This commit is contained in:
Leijurv 2022-07-05 15:27:10 -07:00 committed by GitHub
commit a73e1185dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,8 @@ public class PathExecutor implements IPathExecutor, Helper {
private HashSet<BlockPos> toPlace = new HashSet<>();
private HashSet<BlockPos> toWalkInto = new HashSet<>();
private PathingBehavior behavior;
private IPlayerContext ctx;
private final PathingBehavior behavior;
private final IPlayerContext ctx;
private boolean sprintNextTick;
@ -397,11 +397,20 @@ public class PathExecutor implements IPathExecutor, Helper {
return true;
}
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()));