diff --git a/src/main/java/baritone/behavior/ElytraBehavior.java b/src/main/java/baritone/behavior/ElytraBehavior.java index 3e5dde199..94033d60a 100644 --- a/src/main/java/baritone/behavior/ElytraBehavior.java +++ b/src/main/java/baritone/behavior/ElytraBehavior.java @@ -95,7 +95,11 @@ public final class ElytraBehavior extends Behavior implements Helper { public void pathToDestination(BlockPos destination) { this.destination = destination; this.path0(ctx.playerFeet(), destination, UnaryOperator.identity()) - .thenRun(() -> { + .whenComplete((__, ex) -> { + if (ex != null) { + logDirect("Failed to compute path to destination"); + return; + } final int distance = (int) this.pathAt(0).distanceTo(this.pathAt(this.path.size() - 1)); if (this.completePath) { logDirect(String.format("Computed path (%d blocks)", distance)); @@ -115,8 +119,12 @@ public final class ElytraBehavior extends Behavior implements Helper { final boolean complete = this.completePath; this.path0(ctx.playerFeet(), this.path.get(upToIncl), segment -> segment.append(after.stream(), complete)) - .thenRun(() -> { + .whenComplete((__, ex) -> { this.recalculating = false; + if (ex != null) { + logDirect("Failed to recompute segment"); + return; + } final int recompute = this.path.size() - after.size() - 1; final int distance = (int) this.pathAt(0).distanceTo(this.pathAt(recompute)); logDirect(String.format("Recomputed segment (Next %d blocks)", distance)); @@ -132,8 +140,13 @@ public final class ElytraBehavior extends Behavior implements Helper { final List before = this.path.subList(0, afterIncl + 1); this.path0(this.path.get(afterIncl), this.destination, segment -> segment.prepend(before.stream())) - .thenRun(() -> { + .whenComplete((__, ex) -> { this.recalculating = false; + if (ex != null) { + logDirect("Failed to compute next segment"); + return; + } + final int recompute = this.path.size() - before.size() - 1; final int distance = (int) this.pathAt(0).distanceTo(this.pathAt(recompute));