MCPcopy Index your code
hub / github.com/cabaletta/baritone / PathingBehavior

Class PathingBehavior

src/main/java/baritone/behavior/PathingBehavior.java:49–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47import java.util.concurrent.LinkedBlockingQueue;
48
49public final class PathingBehavior extends Behavior implements IPathingBehavior, Helper {
50
51 private PathExecutor current;
52 private PathExecutor next;
53
54 private Goal goal;
55 private CalculationContext context;
56
57 /*eta*/
58 private int ticksElapsedSoFar;
59 private BetterBlockPos startPosition;
60
61 private boolean safeToCancel;
62 private boolean pauseRequestedLastTick;
63 private boolean unpausedLastTick;
64 private boolean pausedThisTick;
65 private boolean cancelRequested;
66 private boolean calcFailedLastTick;
67
68 private volatile AbstractNodeCostSearch inProgress;
69 private final Object pathCalcLock = new Object();
70
71 private final Object pathPlanLock = new Object();
72
73 private boolean lastAutoJump;
74
75 private BetterBlockPos expectedSegmentStart;
76
77 private final LinkedBlockingQueue<PathEvent> toDispatch = new LinkedBlockingQueue<>();
78
79 public PathingBehavior(Baritone baritone) {
80 super(baritone);
81 }
82
83 private void queuePathEvent(PathEvent event) {
84 toDispatch.add(event);
85 }
86
87 private void dispatchEvents() {
88 ArrayList<PathEvent> curr = new ArrayList<>();
89 toDispatch.drainTo(curr);
90 calcFailedLastTick = curr.contains(PathEvent.CALC_FAILED);
91 for (PathEvent event : curr) {
92 baritone.getGameEventHandler().onPathEvent(event);
93 }
94 }
95
96 @Override
97 public void onTick(TickEvent event) {
98 dispatchEvents();
99 if (event.getType() == TickEvent.Type.OUT) {
100 secretInternalSegmentCancel();
101 baritone.getPathingControlManager().cancelEverything();
102 return;
103 }
104
105 expectedSegmentStart = pathStart();
106 baritone.getPathingControlManager().preTick();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected