Cleaned up 7 duplicate switch statements
This commit is contained in:
parent
5c7ffe6ed1
commit
91c4d8292d
@ -266,6 +266,11 @@ public abstract class Movement implements Helper, MovementHelper {
|
|||||||
} else if (state.getStatus() == MovementStatus.PREPPING) {
|
} else if (state.getStatus() == MovementStatus.PREPPING) {
|
||||||
state.setStatus(MovementStatus.WAITING);
|
state.setStatus(MovementStatus.WAITING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.getStatus() == MovementStatus.WAITING) {
|
||||||
|
state.setStatus(MovementStatus.RUNNING);
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,14 +122,8 @@ public class MovementAscend extends Movement {
|
|||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
// TODO incorporate some behavior from ActionClimb (specifically how it waited until it was at most 1.2 blocks away before starting to jump
|
// TODO incorporate some behavior from ActionClimb (specifically how it waited until it was at most 1.2 blocks away before starting to jump
|
||||||
// for efficiency in ascending minimal height staircases, which is just repeated MovementAscend, so that it doesn't bonk its head on the ceiling repeatedly)
|
// for efficiency in ascending minimal height staircases, which is just repeated MovementAscend, so that it doesn't bonk its head on the ceiling repeatedly)
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerFeet().equals(dest)) {
|
if (playerFeet().equals(dest)) {
|
||||||
return state.setStatus(MovementStatus.SUCCESS);
|
return state.setStatus(MovementStatus.SUCCESS);
|
||||||
|
@ -65,14 +65,8 @@ public class MovementDescend extends Movement {
|
|||||||
@Override
|
@Override
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPos playerFeet = playerFeet();
|
BlockPos playerFeet = playerFeet();
|
||||||
if (playerFeet.equals(dest)) {
|
if (playerFeet.equals(dest)) {
|
||||||
|
@ -52,14 +52,8 @@ public class MovementDiagonal extends Movement {
|
|||||||
@Override
|
@Override
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementState.MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementState.MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerFeet().equals(dest)) {
|
if (playerFeet().equals(dest)) {
|
||||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||||
|
@ -60,14 +60,8 @@ public class MovementDownward extends Movement {
|
|||||||
@Override
|
@Override
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementState.MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementState.MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerFeet().equals(dest)) {
|
if (playerFeet().equals(dest)) {
|
||||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||||
|
@ -80,14 +80,8 @@ public class MovementFall extends Movement {
|
|||||||
@Override
|
@Override
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockPos playerFeet = playerFeet();
|
BlockPos playerFeet = playerFeet();
|
||||||
Rotation targetRotation = null;
|
Rotation targetRotation = null;
|
||||||
|
@ -107,14 +107,8 @@ public class MovementPillar extends Movement {
|
|||||||
@Override
|
@Override
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementState.MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementState.MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
IBlockState fromDown = BlockStateInterface.get(src);
|
IBlockState fromDown = BlockStateInterface.get(src);
|
||||||
boolean ladder = fromDown.getBlock() instanceof BlockLadder || fromDown.getBlock() instanceof BlockVine;
|
boolean ladder = fromDown.getBlock() instanceof BlockLadder || fromDown.getBlock() instanceof BlockVine;
|
||||||
|
@ -129,14 +129,8 @@ public class MovementTraverse extends Movement {
|
|||||||
@Override
|
@Override
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
switch (state.getStatus()) {
|
if (state.getStatus() != MovementState.MovementStatus.RUNNING)
|
||||||
case WAITING:
|
return state;
|
||||||
state.setStatus(MovementState.MovementStatus.RUNNING);
|
|
||||||
case RUNNING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
Block fd = BlockStateInterface.get(src.down()).getBlock();
|
Block fd = BlockStateInterface.get(src.down()).getBlock();
|
||||||
boolean ladder = fd instanceof BlockLadder || fd instanceof BlockVine;
|
boolean ladder = fd instanceof BlockLadder || fd instanceof BlockVine;
|
||||||
|
Loading…
Reference in New Issue
Block a user