use initial estimate from calculation phase
This commit is contained in:
parent
3afd836822
commit
462ccad885
@ -217,17 +217,9 @@ public class PathExecutor implements Helper {
|
|||||||
//displayChatMessageRaw("Recalculating break and place took " + (end - start) + "ms");
|
//displayChatMessageRaw("Recalculating break and place took " + (end - start) + "ms");
|
||||||
}
|
}
|
||||||
Movement movement = path.movements().get(pathPosition);
|
Movement movement = path.movements().get(pathPosition);
|
||||||
double currentCost = movement.recalculateCost();
|
|
||||||
if (currentCost >= ActionCosts.COST_INF) {
|
|
||||||
displayChatMessageRaw("Something has changed in the world and this movement has become impossible. Cancelling.");
|
|
||||||
pathPosition = path.length() + 3;
|
|
||||||
failed = true;
|
|
||||||
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {
|
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {
|
||||||
costEstimateIndex = pathPosition;
|
costEstimateIndex = pathPosition;
|
||||||
currentMovementInitialCostEstimate = currentCost; // do this only once, when the movement starts
|
currentMovementInitialCostEstimate = movement.getCost(null); // do this only once, when the movement starts
|
||||||
for (int i = 1; i < Baritone.settings().costVerificationLookahead.get() && pathPosition + i < path.length() - 1; i++) {
|
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) {
|
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.");
|
displayChatMessageRaw("Something has changed in the world and a future movement has become impossible. Cancelling.");
|
||||||
@ -238,6 +230,14 @@ public class PathExecutor implements Helper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
double currentCost = movement.recalculateCost();
|
||||||
|
if (currentCost >= ActionCosts.COST_INF) {
|
||||||
|
displayChatMessageRaw("Something has changed in the world and this movement has become impossible. Cancelling.");
|
||||||
|
pathPosition = path.length() + 3;
|
||||||
|
failed = true;
|
||||||
|
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
MovementState.MovementStatus movementStatus = movement.update();
|
MovementState.MovementStatus movementStatus = movement.update();
|
||||||
if (movementStatus == UNREACHABLE || movementStatus == FAILED) {
|
if (movementStatus == UNREACHABLE || movementStatus == FAILED) {
|
||||||
displayChatMessageRaw("Movement returns status " + movementStatus);
|
displayChatMessageRaw("Movement returns status " + movementStatus);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user