fixed overzealous cost check

This commit is contained in:
Leijurv 2018-08-26 08:49:56 -07:00
parent f95e35de0a
commit 9a24e6a1a3
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -211,6 +211,9 @@ public class PathExecutor implements Helper {
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
return true;
}
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {
costEstimateIndex = pathPosition;
currentMovementInitialCostEstimate = currentCost; // do this only once, when the movement starts
for (int i = 1; i < Baritone.settings().costVerificationLookahead.get() && pathPosition + i < path.length() - 1; i++) {
if (path.movements().get(pathPosition + i).recalculateCost() >= ActionCosts.COST_INF) {
displayChatMessageRaw("Something has changed in the world and a future movement has become impossible. Cancelling.");
@ -220,9 +223,6 @@ public class PathExecutor implements Helper {
return true;
}
}
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {
costEstimateIndex = pathPosition;
currentMovementInitialCostEstimate = currentCost; // do this only once, when the movement starts
}
MovementState.MovementStatus movementStatus = movement.update();
if (movementStatus == UNREACHABLE || movementStatus == FAILED) {