Skip to content

Commit

Permalink
fix path start in diagonal and downward
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Jul 7, 2019
1 parent 4259764 commit b81bcf8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/main/java/baritone/pathing/movement/Movement.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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;
Expand Down Expand Up @@ -110,6 +111,10 @@ public Set<BetterBlockPos> getValidPositions() {
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public MovementState updateState(MovementState state) {

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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public MovementState updateState(MovementState state) {

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);
Expand Down

0 comments on commit b81bcf8

Please sign in to comment.