fix path start in diagonal and downward

This commit is contained in:
Leijurv 2019-07-07 11:44:56 -07:00
parent 4259764b70
commit b81bcf8c6d
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import baritone.api.pathing.movement.IMovement;
import baritone.api.pathing.movement.MovementStatus;
import baritone.api.utils.*;
import baritone.api.utils.input.Input;
import baritone.behavior.PathingBehavior;
import baritone.utils.BlockStateInterface;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.item.EntityFallingBlock;
@ -110,6 +111,10 @@ public abstract class Movement implements IMovement, MovementHelper {
return validPositionsCached;
}
protected boolean playerInValidPosition() {
return getValidPositions().contains(ctx.playerFeet()) || getValidPositions().contains(((PathingBehavior) baritone.getPathingBehavior()).pathStart());
}
/**
* Handles the execution of the latest Movement
* State, and offers a Status to the calling class.

View File

@ -184,7 +184,7 @@ public class MovementDiagonal extends Movement {
if (ctx.playerFeet().equals(dest)) {
return state.setStatus(MovementStatus.SUCCESS);
} else if (!getValidPositions().contains(ctx.playerFeet()) && !(MovementHelper.isLiquid(ctx, src) && getValidPositions().contains(ctx.playerFeet().up()))) {
} else if (!playerInValidPosition() && !(MovementHelper.isLiquid(ctx, src) && getValidPositions().contains(ctx.playerFeet().up()))) {
return state.setStatus(MovementStatus.UNREACHABLE);
}
if (sprint()) {

View File

@ -81,7 +81,7 @@ public class MovementDownward extends Movement {
if (ctx.playerFeet().equals(dest)) {
return state.setStatus(MovementStatus.SUCCESS);
} else if (!getValidPositions().contains(ctx.playerFeet())) {
} else if (!playerInValidPosition()) {
return state.setStatus(MovementStatus.UNREACHABLE);
}
double diffX = ctx.player().posX - (dest.getX() + 0.5);