fix path start in diagonal and downward
This commit is contained in:
parent
4259764b70
commit
b81bcf8c6d
@ -23,6 +23,7 @@ import baritone.api.pathing.movement.IMovement;
|
|||||||
import baritone.api.pathing.movement.MovementStatus;
|
import baritone.api.pathing.movement.MovementStatus;
|
||||||
import baritone.api.utils.*;
|
import baritone.api.utils.*;
|
||||||
import baritone.api.utils.input.Input;
|
import baritone.api.utils.input.Input;
|
||||||
|
import baritone.behavior.PathingBehavior;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.entity.item.EntityFallingBlock;
|
import net.minecraft.entity.item.EntityFallingBlock;
|
||||||
@ -110,6 +111,10 @@ public abstract class Movement implements IMovement, MovementHelper {
|
|||||||
return validPositionsCached;
|
return validPositionsCached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean playerInValidPosition() {
|
||||||
|
return getValidPositions().contains(ctx.playerFeet()) || getValidPositions().contains(((PathingBehavior) baritone.getPathingBehavior()).pathStart());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the execution of the latest Movement
|
* Handles the execution of the latest Movement
|
||||||
* State, and offers a Status to the calling class.
|
* State, and offers a Status to the calling class.
|
||||||
|
@ -184,7 +184,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
|
|
||||||
if (ctx.playerFeet().equals(dest)) {
|
if (ctx.playerFeet().equals(dest)) {
|
||||||
return state.setStatus(MovementStatus.SUCCESS);
|
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);
|
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
}
|
}
|
||||||
if (sprint()) {
|
if (sprint()) {
|
||||||
|
@ -81,7 +81,7 @@ public class MovementDownward extends Movement {
|
|||||||
|
|
||||||
if (ctx.playerFeet().equals(dest)) {
|
if (ctx.playerFeet().equals(dest)) {
|
||||||
return state.setStatus(MovementStatus.SUCCESS);
|
return state.setStatus(MovementStatus.SUCCESS);
|
||||||
} else if (!getValidPositions().contains(ctx.playerFeet())) {
|
} else if (!playerInValidPosition()) {
|
||||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
}
|
}
|
||||||
double diffX = ctx.player().posX - (dest.getX() + 0.5);
|
double diffX = ctx.player().posX - (dest.getX() + 0.5);
|
||||||
|
Loading…
Reference in New Issue
Block a user