move updateState after calculateCost for consistency with every other movement
This commit is contained in:
parent
81ffbddc94
commit
d40418d344
@ -50,29 +50,6 @@ public class MovementDiagonal extends Movement {
|
||||
super(start, end, new BlockPos[]{dir1, dir1.up(), dir2, dir2.up(), end, end.up()});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovementState updateState(MovementState state) {
|
||||
super.updateState(state);
|
||||
switch (state.getStatus()) {
|
||||
case WAITING:
|
||||
state.setStatus(MovementState.MovementStatus.RUNNING);
|
||||
case RUNNING:
|
||||
break;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
if (playerFeet().equals(dest)) {
|
||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
return state;
|
||||
}
|
||||
if (!BlockStateInterface.isLiquid(playerFeet())) {
|
||||
state.setInput(InputOverrideHandler.Input.SPRINT, true);
|
||||
}
|
||||
MovementHelper.moveTowards(state, dest);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
Block fromDown = BlockStateInterface.get(src.down()).getBlock();
|
||||
@ -139,6 +116,29 @@ public class MovementDiagonal extends Movement {
|
||||
return multiplier * SQRT_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovementState updateState(MovementState state) {
|
||||
super.updateState(state);
|
||||
switch (state.getStatus()) {
|
||||
case WAITING:
|
||||
state.setStatus(MovementState.MovementStatus.RUNNING);
|
||||
case RUNNING:
|
||||
break;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
if (playerFeet().equals(dest)) {
|
||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
return state;
|
||||
}
|
||||
if (!BlockStateInterface.isLiquid(playerFeet())) {
|
||||
state.setInput(InputOverrideHandler.Input.SPRINT, true);
|
||||
}
|
||||
MovementHelper.moveTowards(state, dest);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean prepared(MovementState state) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user