mostRecentGoal, fixes immediate goal clear
This commit is contained in:
@@ -42,7 +42,7 @@ public class ElytraCommand extends Command {
|
||||
public void execute(String label, IArgConsumer args) throws CommandException {
|
||||
ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
|
||||
args.requireMax(0);
|
||||
Goal iGoal = customGoalProcess.getGoal();
|
||||
Goal iGoal = customGoalProcess.mostRecentGoal();
|
||||
if (iGoal == null) {
|
||||
throw new CommandInvalidStateException("No goal has been set");
|
||||
}
|
||||
|
||||
@@ -36,6 +36,11 @@ public final class CustomGoalProcess extends BaritoneProcessHelper implements IC
|
||||
*/
|
||||
private Goal goal;
|
||||
|
||||
/**
|
||||
* The most recent goal. Not invalidated upon {@link #onLostControl()}
|
||||
*/
|
||||
private Goal mostRecentGoal;
|
||||
|
||||
/**
|
||||
* The current process state.
|
||||
*
|
||||
@@ -50,6 +55,7 @@ public final class CustomGoalProcess extends BaritoneProcessHelper implements IC
|
||||
@Override
|
||||
public void setGoal(Goal goal) {
|
||||
this.goal = goal;
|
||||
this.mostRecentGoal = goal;
|
||||
if (this.state == State.NONE) {
|
||||
this.state = State.GOAL_SET;
|
||||
}
|
||||
@@ -68,6 +74,11 @@ public final class CustomGoalProcess extends BaritoneProcessHelper implements IC
|
||||
return this.goal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Goal mostRecentGoal() {
|
||||
return this.mostRecentGoal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return this.state != State.NONE;
|
||||
|
||||
Reference in New Issue
Block a user