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 (playerFeet.equals(dest)) {
|
||||||
if (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.094) { // lilypads
|
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
|
// 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.setStatus(MovementStatus.SUCCESS);
|
||||||
return state;
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println(player().posY + " " + playerFeet.getY() + " " + (player().posY - playerFeet.getY()));
|
System.out.println(player().posY + " " + playerFeet.getY() + " " + (player().posY - playerFeet.getY()));
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,7 @@ public class MovementDownward extends Movement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (playerFeet().equals(dest)) {
|
if (playerFeet().equals(dest)) {
|
||||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
return state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
double diffX = player().posX - (dest.getX() + 0.5);
|
double diffX = player().posX - (dest.getX() + 0.5);
|
||||||
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
||||||
|
@ -113,8 +113,7 @@ public class MovementFall extends Movement {
|
|||||||
Rotation targetRotation = null;
|
Rotation targetRotation = null;
|
||||||
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > Baritone.settings().maxFallHeightNoWater.get() && !playerFeet.equals(dest)) {
|
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()) {
|
if (!InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER)) || world().provider.isNether()) {
|
||||||
state.setStatus(MovementStatus.UNREACHABLE);
|
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player().posY - dest.getY() < mc.playerController.getBlockReachDistance()) {
|
if (player().posY - dest.getY() < mc.playerController.getBlockReachDistance()) {
|
||||||
|
@ -160,8 +160,7 @@ public class MovementPillar extends Movement {
|
|||||||
} else {
|
} else {
|
||||||
// Get ready to place a throwaway block
|
// Get ready to place a throwaway block
|
||||||
if (!MovementHelper.throwaway(true)) {
|
if (!MovementHelper.throwaway(true)) {
|
||||||
state.setStatus(MovementState.MovementStatus.UNREACHABLE);
|
return state.setStatus(MovementState.MovementStatus.UNREACHABLE);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
numTicks++;
|
numTicks++;
|
||||||
|
@ -180,9 +180,8 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
if (isDoorActuallyBlockingUs) {
|
if (isDoorActuallyBlockingUs) {
|
||||||
if (!(Blocks.IRON_DOOR.equals(pb0.getBlock()) || Blocks.IRON_DOOR.equals(pb1.getBlock()))) {
|
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));
|
return state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())), true))
|
||||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,9 +195,8 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (blocked != null) {
|
if (blocked != null) {
|
||||||
state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(blocked, world())), true));
|
return state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(blocked, world())), true))
|
||||||
state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,8 +212,7 @@ public class MovementTraverse extends Movement {
|
|||||||
|
|
||||||
if (isTheBridgeBlockThere) {
|
if (isTheBridgeBlockThere) {
|
||||||
if (playerFeet().equals(dest)) {
|
if (playerFeet().equals(dest)) {
|
||||||
state.setStatus(MovementState.MovementStatus.SUCCESS);
|
return state.setStatus(MovementState.MovementStatus.SUCCESS);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
if (wasTheBridgeBlockAlwaysThere && !BlockStateInterface.isLiquid(playerFeet())) {
|
if (wasTheBridgeBlockAlwaysThere && !BlockStateInterface.isLiquid(playerFeet())) {
|
||||||
state.setInput(InputOverrideHandler.Input.SPRINT, true);
|
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));
|
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
|
if (dist < 0.85) { // 0.5 + 0.3 + epsilon
|
||||||
MovementHelper.moveTowards(state, dest);
|
MovementHelper.moveTowards(state, dest);
|
||||||
state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false);
|
return state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false)
|
||||||
state.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.setInput(InputOverrideHandler.Input.MOVE_BACK, false);
|
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.MOVE_BACK, true);
|
||||||
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
||||||
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), goalLook)) {
|
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.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); // wait to right click until we are able to place
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
// Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt());
|
// Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt());
|
||||||
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
|
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user