fix that null exception

This commit is contained in:
Leijurv 2019-04-19 14:20:00 -07:00
parent 7e3aa6efdd
commit 47e1c67bd8
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 12 additions and 7 deletions

View File

@ -51,5 +51,10 @@ public enum PathingCommandType {
* <p>
* Cancel the current path if the goals are not equal
*/
FORCE_REVALIDATE_GOAL_AND_PATH
FORCE_REVALIDATE_GOAL_AND_PATH,
/**
* Go and ask the next process what to do
*/
DEFER
}

View File

@ -87,7 +87,7 @@ public class BackfillProcess extends BaritoneProcessHelper {
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
}
}
return null; // cede to other process
return new PathingCommand(null, PathingCommandType.DEFER); // cede to other process
}
public void amIBreakingABlockHMMMMMMM() {
@ -119,7 +119,7 @@ public class BackfillProcess extends BaritoneProcessHelper {
@Override
public void onLostControl() {
blocksToReplace = new HashMap<>();
blocksToReplace.clear();
}
@Override

View File

@ -199,11 +199,11 @@ public class PathingControlManager implements IPathingControlManager {
PathingCommand exec = proc.onTick(Objects.equals(proc, inControlLastTick) && baritone.getPathingBehavior().calcFailedLastTick(), baritone.getPathingBehavior().isSafeToCancel());
if (exec == null) {
/*if (proc.isActive()) {
throw new IllegalStateException(proc.displayName() + " returned null PathingCommand");
if (proc.isActive()) {
throw new IllegalStateException(proc.displayName() + " actively returned null PathingCommand");
}
proc.onLostControl();*/
} else {
// no need to call onLostControl; they are reporting inactive.
} else if (exec.commandType != PathingCommandType.DEFER) {
inControlThisTick = proc;
if (!proc.isTemporary()) {
iterator.forEachRemaining(IBaritoneProcess::onLostControl);