really cancel, fixes #178
This commit is contained in:
parent
7b0f14a0e5
commit
4ec9a4fc5b
@ -23,10 +23,10 @@ import baritone.api.event.events.PathEvent;
|
|||||||
import baritone.api.event.events.PlayerUpdateEvent;
|
import baritone.api.event.events.PlayerUpdateEvent;
|
||||||
import baritone.api.event.events.RenderEvent;
|
import baritone.api.event.events.RenderEvent;
|
||||||
import baritone.api.event.events.TickEvent;
|
import baritone.api.event.events.TickEvent;
|
||||||
|
import baritone.api.pathing.goals.Goal;
|
||||||
import baritone.pathing.calc.AStarPathFinder;
|
import baritone.pathing.calc.AStarPathFinder;
|
||||||
import baritone.pathing.calc.AbstractNodeCostSearch;
|
import baritone.pathing.calc.AbstractNodeCostSearch;
|
||||||
import baritone.pathing.calc.IPathFinder;
|
import baritone.pathing.calc.IPathFinder;
|
||||||
import baritone.api.pathing.goals.Goal;
|
|
||||||
import baritone.pathing.goals.GoalXZ;
|
import baritone.pathing.goals.GoalXZ;
|
||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.pathing.path.IPath;
|
import baritone.pathing.path.IPath;
|
||||||
@ -220,6 +220,10 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(AbstractNodeCostSearch::cancel);
|
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(AbstractNodeCostSearch::cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forceCancel() { // NOT exposed on public api
|
||||||
|
isPathCalcInProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start calculating a path if we aren't already
|
* Start calculating a path if we aren't already
|
||||||
*
|
*
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package baritone.pathing.calc;
|
package baritone.pathing.calc;
|
||||||
|
|
||||||
import baritone.api.pathing.goals.Goal;
|
import baritone.api.pathing.goals.Goal;
|
||||||
import baritone.behavior.PathingBehavior;
|
|
||||||
import baritone.pathing.path.IPath;
|
import baritone.pathing.path.IPath;
|
||||||
import baritone.utils.pathing.BetterBlockPos;
|
import baritone.utils.pathing.BetterBlockPos;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
@ -159,7 +158,6 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void forceCancel() {
|
public static void forceCancel() {
|
||||||
PathingBehavior.INSTANCE.cancel();
|
|
||||||
currentlyRunning = null;
|
currentlyRunning = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,11 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg.equals("forcecancel")) {
|
if (msg.equals("forcecancel")) {
|
||||||
|
MineBehavior.INSTANCE.cancel();
|
||||||
|
FollowBehavior.INSTANCE.cancel();
|
||||||
|
PathingBehavior.INSTANCE.cancel();
|
||||||
AbstractNodeCostSearch.forceCancel();
|
AbstractNodeCostSearch.forceCancel();
|
||||||
|
PathingBehavior.INSTANCE.forceCancel();
|
||||||
event.cancel();
|
event.cancel();
|
||||||
logDirect("ok force canceled");
|
logDirect("ok force canceled");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user