really cancel, fixes #178

This commit is contained in:
Leijurv 2018-09-24 09:57:06 -07:00
parent 7b0f14a0e5
commit 4ec9a4fc5b
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 9 additions and 3 deletions

View File

@ -23,10 +23,10 @@ import baritone.api.event.events.PathEvent;
import baritone.api.event.events.PlayerUpdateEvent;
import baritone.api.event.events.RenderEvent;
import baritone.api.event.events.TickEvent;
import baritone.api.pathing.goals.Goal;
import baritone.pathing.calc.AStarPathFinder;
import baritone.pathing.calc.AbstractNodeCostSearch;
import baritone.pathing.calc.IPathFinder;
import baritone.api.pathing.goals.Goal;
import baritone.pathing.goals.GoalXZ;
import baritone.pathing.movement.MovementHelper;
import baritone.pathing.path.IPath;
@ -220,6 +220,10 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(AbstractNodeCostSearch::cancel);
}
public void forceCancel() { // NOT exposed on public api
isPathCalcInProgress = false;
}
/**
* Start calculating a path if we aren't already
*

View File

@ -18,7 +18,6 @@
package baritone.pathing.calc;
import baritone.api.pathing.goals.Goal;
import baritone.behavior.PathingBehavior;
import baritone.pathing.path.IPath;
import baritone.utils.pathing.BetterBlockPos;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@ -159,7 +158,6 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
}
public static void forceCancel() {
PathingBehavior.INSTANCE.cancel();
currentlyRunning = null;
}

View File

@ -206,7 +206,11 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return;
}
if (msg.equals("forcecancel")) {
MineBehavior.INSTANCE.cancel();
FollowBehavior.INSTANCE.cancel();
PathingBehavior.INSTANCE.cancel();
AbstractNodeCostSearch.forceCancel();
PathingBehavior.INSTANCE.forceCancel();
event.cancel();
logDirect("ok force canceled");
return;