MovementStatus javadocs

This commit is contained in:
Brady 2018-10-08 23:52:36 -05:00
parent 2e69bbe371
commit 0fb5f3233f
No known key found for this signature in database
GPG Key ID: 73A788379A197567
2 changed files with 50 additions and 8 deletions

View File

@ -23,5 +23,52 @@ package baritone.api.pathing.movement;
*/
public enum MovementStatus {
PREPPING, WAITING, RUNNING, SUCCESS, UNREACHABLE, FAILED, CANCELED
/**
* We are preparing the movement to be executed. This is when any blocks obstructing the destination are broken.
*/
PREPPING(false),
/**
* We are waiting for the movement to begin, after {@link MovementStatus#PREPPING}.
*/
WAITING(false),
/**
* The movement is currently in progress, after {@link MovementStatus#WAITING}
*/
RUNNING(false),
/**
* The movement has been completed and we are at our destination
*/
SUCCESS(true),
/**
* There was a change in state between calculation and actual
* movement execution, and the movement has now become impossible.
*/
UNREACHABLE(true),
/**
* Unused
*/
FAILED(true),
/**
* "Unused"
*/
CANCELED(true);
/**
* Whether or not this status indicates a complete movement.
*/
private final boolean complete;
MovementStatus(boolean complete) {
this.complete = complete;
}
public final boolean isComplete() {
return this.complete;
}
}

View File

@ -152,7 +152,8 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
currentState = latestState;
if (isFinished()) {
// If the current status indicates a completed movement
if (currentState.getStatus().isComplete()) {
onFinish(latestState);
}
@ -201,12 +202,6 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
return true;
}
public boolean isFinished() {
return (currentState.getStatus() != MovementStatus.RUNNING
&& currentState.getStatus() != MovementStatus.PREPPING
&& currentState.getStatus() != MovementStatus.WAITING);
}
@Override
public BetterBlockPos getSrc() {
return src;