traverse place against below
This commit is contained in:
parent
2760354943
commit
64eabf71f2
@ -36,6 +36,7 @@ import java.util.Optional;
|
|||||||
public abstract class Movement implements IMovement, MovementHelper {
|
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 = {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 IBaritone baritone;
|
||||||
protected final IPlayerContext ctx;
|
protected final IPlayerContext ctx;
|
||||||
@ -208,7 +209,6 @@ public abstract class Movement implements IMovement, MovementHelper {
|
|||||||
* Calculate latest movement state. Gets called once a tick.
|
* Calculate latest movement state. Gets called once a tick.
|
||||||
*
|
*
|
||||||
* @param state The current state
|
* @param state The current state
|
||||||
*
|
|
||||||
* @return The new state
|
* @return The new state
|
||||||
*/
|
*/
|
||||||
public MovementState updateState(MovementState state) {
|
public MovementState updateState(MovementState state) {
|
||||||
|
@ -37,8 +37,6 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
|
|
||||||
import java.util.Objects;
|
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 {
|
public class MovementAscend extends Movement {
|
||||||
|
|
||||||
private int ticksWithoutPlacement = 0;
|
private int ticksWithoutPlacement = 0;
|
||||||
|
@ -41,7 +41,6 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
|
|
||||||
public class MovementParkour extends Movement {
|
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 static final BetterBlockPos[] EMPTY = new BetterBlockPos[]{};
|
||||||
|
|
||||||
private final EnumFacing direction;
|
private final EnumFacing direction;
|
||||||
|
@ -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 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;
|
double WC = throughWater ? context.waterWalkSpeed() : WALK_ONE_BLOCK_COST;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
int againstX = destX + HORIZONTALS[i].getXOffset();
|
int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getXOffset();
|
||||||
int againstZ = destZ + HORIZONTALS[i].getZOffset();
|
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
|
if (againstX == x && againstZ == z) { // this would be a backplace
|
||||||
continue;
|
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;
|
return WC + context.placeBlockCost() + hardness1 + hardness2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,8 +242,8 @@ public class MovementTraverse extends Movement {
|
|||||||
return state;
|
return state;
|
||||||
} else {
|
} else {
|
||||||
wasTheBridgeBlockAlwaysThere = false;
|
wasTheBridgeBlockAlwaysThere = false;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
BlockPos against1 = dest.offset(HORIZONTALS[i]);
|
BlockPos against1 = dest.offset(HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i]);
|
||||||
if (against1.equals(src)) {
|
if (against1.equals(src)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user