added maxCostIncrease, fixes #154
This commit is contained in:
parent
e6c574063e
commit
1bf34d42e2
@ -144,6 +144,12 @@ public class Settings {
|
||||
*/
|
||||
public Setting<Boolean> cutoffAtLoadBoundary = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* If a movement's cost increases by more than this amount between calculation and execution (due to changes
|
||||
* in the environment / world), cancel and recalculate
|
||||
*/
|
||||
public Setting<Double> maxCostIncrease = new Setting<>(10D);
|
||||
|
||||
/**
|
||||
* Stop 5 movements before anything that made the path COST_INF.
|
||||
* For example, if lava has spread across the path, don't walk right up to it then recalculate, it might
|
||||
|
@ -236,6 +236,13 @@ public class PathExecutor implements Helper {
|
||||
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||
return true;
|
||||
}
|
||||
if (currentCost - currentMovementInitialCostEstimate > Baritone.settings().maxCostIncrease.get()) {
|
||||
logDebug("Original cost " + currentMovementInitialCostEstimate + " current cost " + currentCost + ". Cancelling.");
|
||||
pathPosition = path.length() + 3;
|
||||
failed = true;
|
||||
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||
return true;
|
||||
}
|
||||
player().capabilities.allowFlying = false;
|
||||
MovementState.MovementStatus movementStatus = movement.update();
|
||||
if (movementStatus == UNREACHABLE || movementStatus == FAILED) {
|
||||
|
Loading…
Reference in New Issue
Block a user