From 64eabf71f2c7d6142f1923b460aa2ffc9b992a85 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 5 Dec 2018 08:29:32 -0800 Subject: [PATCH] traverse place against below --- .../java/baritone/pathing/movement/Movement.java | 2 +- .../pathing/movement/movements/MovementAscend.java | 2 -- .../pathing/movement/movements/MovementParkour.java | 1 - .../movement/movements/MovementTraverse.java | 13 +++++++------ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 7ba9f6ea..38cc329b 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -36,6 +36,7 @@ import java.util.Optional; public abstract class Movement implements IMovement, MovementHelper { protected static final EnumFacing[] HORIZONTALS = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST}; + protected static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN}; protected final IBaritone baritone; protected final IPlayerContext ctx; @@ -208,7 +209,6 @@ public abstract class Movement implements IMovement, MovementHelper { * Calculate latest movement state. Gets called once a tick. * * @param state The current state - * * @return The new state */ public MovementState updateState(MovementState state) { diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index c3a34fd9..735c94b8 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -37,8 +37,6 @@ import net.minecraft.util.math.Vec3d; import java.util.Objects; -import static baritone.pathing.movement.movements.MovementParkour.HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP; - public class MovementAscend extends Movement { private int ticksWithoutPlacement = 0; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index b1ab712a..2d6e0b2f 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -41,7 +41,6 @@ import net.minecraft.util.math.Vec3d; public class MovementParkour extends Movement { - static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN}; private static final BetterBlockPos[] EMPTY = new BetterBlockPos[]{}; private final EnumFacing direction; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index f71cec9d..59720b91 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -118,13 +118,14 @@ public class MovementTraverse extends Movement { } double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y + 1, destZ, pb0, true); // only include falling on the upper block to break double WC = throughWater ? context.waterWalkSpeed() : WALK_ONE_BLOCK_COST; - for (int i = 0; i < 4; i++) { - int againstX = destX + HORIZONTALS[i].getXOffset(); - int againstZ = destZ + HORIZONTALS[i].getZOffset(); + for (int i = 0; i < 5; i++) { + int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getXOffset(); + int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getYOffset(); + int againstZ = destZ + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getZOffset(); if (againstX == x && againstZ == z) { // this would be a backplace continue; } - if (MovementHelper.canPlaceAgainst(context.bsi(), againstX, y - 1, againstZ)) { // found a side place option + if (MovementHelper.canPlaceAgainst(context.bsi(), againstX, againstY, againstZ)) { // found a side place option return WC + context.placeBlockCost() + hardness1 + hardness2; } } @@ -241,8 +242,8 @@ public class MovementTraverse extends Movement { return state; } else { wasTheBridgeBlockAlwaysThere = false; - for (int i = 0; i < 4; i++) { - BlockPos against1 = dest.offset(HORIZONTALS[i]); + for (int i = 0; i < 5; i++) { + BlockPos against1 = dest.offset(HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i]); if (against1.equals(src)) { continue; }