diff --git a/src/main/java/baritone/process/ElytraProcess.java b/src/main/java/baritone/process/ElytraProcess.java index 757e9a294..33acd6d4e 100644 --- a/src/main/java/baritone/process/ElytraProcess.java +++ b/src/main/java/baritone/process/ElytraProcess.java @@ -149,9 +149,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro if (ctx.player().posY < endPos.y - LANDING_COLUMN_HEIGHT) { logDirect("bad landing spot, trying again..."); - badLandingSpots.add(endPos); - goingToLandingSpot = false; - this.state = State.FLYING; + landingSpotIsBad(endPos); } } } @@ -245,6 +243,13 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL); } + public void landingSpotIsBad(BetterBlockPos endPos) { + badLandingSpots.add(endPos); + goingToLandingSpot = false; + this.landingSpot = null; + this.state = State.FLYING; + } + @Override public void onLostControl() { this.goal = null; diff --git a/src/main/java/baritone/process/elytra/ElytraBehavior.java b/src/main/java/baritone/process/elytra/ElytraBehavior.java index 503944981..4164bae5e 100644 --- a/src/main/java/baritone/process/elytra/ElytraBehavior.java +++ b/src/main/java/baritone/process/elytra/ElytraBehavior.java @@ -219,8 +219,9 @@ public final class ElytraBehavior implements Helper { this.recalculating = true; final List before = this.path.subList(0, afterIncl + 1); final long start = System.nanoTime(); + final BetterBlockPos pathStart = this.path.get(afterIncl); - this.path0(this.path.get(afterIncl), ElytraBehavior.this.destination, segment -> segment.prepend(before.stream())) + this.path0(pathStart, ElytraBehavior.this.destination, segment -> segment.prepend(before.stream())) .thenRun(() -> { final int recompute = this.path.size() - before.size() - 1; final double distance = this.path.get(0).distanceTo(this.path.get(recompute)); @@ -237,6 +238,10 @@ public final class ElytraBehavior implements Helper { final Throwable cause = ex.getCause(); if (cause instanceof PathCalculationException) { logDirect("Failed to compute next segment"); + if (ctx.player().getDistanceSq(pathStart) < 16 * 16) { + logDirect("Player is near the segment start, therefore repeating this calculation is pointless. Marking as complete"); + completePath = true; + } } else { logUnhandledException(cause); } @@ -260,6 +265,9 @@ public final class ElytraBehavior implements Helper { BlockPos last = !path.isEmpty() ? path.get(path.size() - 1) : null; if (last != null && ElytraBehavior.this.clearView(new Vec3d(dest), new Vec3d(last), false)) { path.add(new BetterBlockPos(dest)); + } else { + logDirect("unable to land at " + ElytraBehavior.this.destination); + process.landingSpotIsBad(new BetterBlockPos(ElytraBehavior.this.destination)); } } this.path = new NetherPath(path);