MovementStatus javadocs
This commit is contained in:
parent
2e69bbe371
commit
0fb5f3233f
@ -23,5 +23,52 @@ package baritone.api.pathing.movement;
|
|||||||
*/
|
*/
|
||||||
public enum MovementStatus {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,8 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
|
|||||||
|
|
||||||
currentState = latestState;
|
currentState = latestState;
|
||||||
|
|
||||||
if (isFinished()) {
|
// If the current status indicates a completed movement
|
||||||
|
if (currentState.getStatus().isComplete()) {
|
||||||
onFinish(latestState);
|
onFinish(latestState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,12 +202,6 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFinished() {
|
|
||||||
return (currentState.getStatus() != MovementStatus.RUNNING
|
|
||||||
&& currentState.getStatus() != MovementStatus.PREPPING
|
|
||||||
&& currentState.getStatus() != MovementStatus.WAITING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BetterBlockPos getSrc() {
|
public BetterBlockPos getSrc() {
|
||||||
return src;
|
return src;
|
||||||
|
Loading…
Reference in New Issue
Block a user