Skip to content

Commit

Permalink
pathStart() = feet if we're at the goal
Browse files Browse the repository at this point in the history
  • Loading branch information
babbaj committed Oct 14, 2024
1 parent ef72c56 commit 3a362f4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/baritone/behavior/PathingBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ private void resetEstimatedTicksToGoal(BetterBlockPos start) {
*/
public BetterBlockPos pathStart() { // TODO move to a helper or util class
BetterBlockPos feet = ctx.playerFeet();
BetterBlockPos out = feet;
if (!MovementHelper.canWalkOn(ctx, feet.below())) {
if (ctx.player().isOnGround()) {
double playerX = ctx.player().position().x;
Expand All @@ -444,7 +445,7 @@ public BetterBlockPos pathStart() { // TODO move to a helper or util class
if (MovementHelper.canWalkOn(ctx, possibleSupport.below()) && MovementHelper.canWalkThrough(ctx, possibleSupport) && MovementHelper.canWalkThrough(ctx, possibleSupport.above())) {
// this is plausible
//logDebug("Faking path start assuming player is standing off the edge of a block");
return possibleSupport;
out = possibleSupport;
}
}

Expand All @@ -453,11 +454,15 @@ public BetterBlockPos pathStart() { // TODO move to a helper or util class
// we're in the middle of a jump
if (MovementHelper.canWalkOn(ctx, feet.below().below())) {
//logDebug("Faking path start assuming player is midair and falling");
return feet.below();
out = feet.below();
}
}
}
return feet;
// If the start is the same as the goal then assume it's safe so the path can complete
if (goal != null && goal.isInGoal(out)) {
return feet;
}
return out;
}

/**
Expand Down

0 comments on commit 3a362f4

Please sign in to comment.