Utilize the fact that all MovementState methods return "this"
This commit is contained in:
parent
d2be54f138
commit
583a5046ef
@ -76,8 +76,7 @@ public class MovementDescend extends Movement {
|
||||
if (playerFeet.equals(dest)) {
|
||||
if (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.094) { // lilypads
|
||||
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
|
||||
state.setStatus(MovementStatus.SUCCESS);
|
||||
return state;
|
||||
return state.setStatus(MovementStatus.SUCCESS);
|
||||
} else {
|
||||
System.out.println(player().posY + " " + playerFeet.getY() + " " + (player().posY - playerFeet.getY()));
|
||||
}
|
||||
|
@ -66,8 +66,7 @@ public class MovementDownward extends Movement {
|
||||
}
|
||||
|
||||
if (playerFeet().equals(dest)) {
|
||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
return state;
|
||||
return state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
}
|
||||
double diffX = player().posX - (dest.getX() + 0.5);
|
||||
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
||||
|
@ -113,8 +113,7 @@ public class MovementFall extends Movement {
|
||||
Rotation targetRotation = null;
|
||||
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > Baritone.settings().maxFallHeightNoWater.get() && !playerFeet.equals(dest)) {
|
||||
if (!InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER)) || world().provider.isNether()) {
|
||||
state.setStatus(MovementStatus.UNREACHABLE);
|
||||
return state;
|
||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||
}
|
||||
|
||||
if (player().posY - dest.getY() < mc.playerController.getBlockReachDistance()) {
|
||||
|
@ -160,8 +160,7 @@ public class MovementPillar extends Movement {
|
||||
} else {
|
||||
// Get ready to place a throwaway block
|
||||
if (!MovementHelper.throwaway(true)) {
|
||||
state.setStatus(MovementState.MovementStatus.UNREACHABLE);
|
||||
return state;
|
||||
return state.setStatus(MovementState.MovementStatus.UNREACHABLE);
|
||||
}
|
||||
|
||||
numTicks++;
|
||||
|
@ -180,9 +180,8 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
if (isDoorActuallyBlockingUs) {
|
||||
if (!(Blocks.IRON_DOOR.equals(pb0.getBlock()) || Blocks.IRON_DOOR.equals(pb1.getBlock()))) {
|
||||
state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())), true));
|
||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||
return state;
|
||||
return state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())), true))
|
||||
.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -196,9 +195,8 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
|
||||
if (blocked != null) {
|
||||
state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(blocked, world())), true));
|
||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||
return state;
|
||||
return state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(blocked, world())), true))
|
||||
.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,8 +212,7 @@ public class MovementTraverse extends Movement {
|
||||
|
||||
if (isTheBridgeBlockThere) {
|
||||
if (playerFeet().equals(dest)) {
|
||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
return state;
|
||||
return state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||
}
|
||||
if (wasTheBridgeBlockAlwaysThere && !BlockStateInterface.isLiquid(playerFeet())) {
|
||||
state.setInput(InputOverrideHandler.Input.SPRINT, true);
|
||||
@ -248,9 +245,8 @@ public class MovementTraverse extends Movement {
|
||||
double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ));
|
||||
if (dist < 0.85) { // 0.5 + 0.3 + epsilon
|
||||
MovementHelper.moveTowards(state, dest);
|
||||
state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false);
|
||||
state.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
||||
return state;
|
||||
return state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false)
|
||||
.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
||||
}
|
||||
}
|
||||
state.setInput(InputOverrideHandler.Input.MOVE_BACK, false);
|
||||
@ -290,8 +286,7 @@ public class MovementTraverse extends Movement {
|
||||
state.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
||||
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
||||
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), goalLook)) {
|
||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); // wait to right click until we are able to place
|
||||
return state;
|
||||
return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); // wait to right click until we are able to place
|
||||
}
|
||||
// Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt());
|
||||
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
|
||||
|
Loading…
Reference in New Issue
Block a user