diff --git a/src/main/java/baritone/process/ElytraProcess.java b/src/main/java/baritone/process/ElytraProcess.java index 6a19707e4..cfcf5373f 100644 --- a/src/main/java/baritone/process/ElytraProcess.java +++ b/src/main/java/baritone/process/ElytraProcess.java @@ -113,7 +113,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro BetterBlockPos landingSpot = findSafeLandingSpot(last); // if this fails we will just keep orbiting the last node until we run out of rockets or the user intervenes if (landingSpot != null) { - this.pathTo(landingSpot); + this.pathTo0(landingSpot, true); this.landingSpot = landingSpot; this.goingToLandingSpot = true; } @@ -248,6 +248,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro public void onLostControl() { this.goal = null; this.goingToLandingSpot = false; + this.landingSpot = null; this.reachedGoal = false; this.state = State.START_FLYING; // TODO: null state? if (this.behavior != null) { @@ -280,11 +281,15 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro @Override public void pathTo(BlockPos destination) { + this.pathTo0(destination, false); + } + + private void pathTo0(BlockPos destination, boolean appendDestination) { if (ctx.player() == null || ctx.player().dimension != -1) { return; } this.onLostControl(); - this.behavior = new ElytraBehavior(this.baritone, this, destination); + this.behavior = new ElytraBehavior(this.baritone, this, destination, appendDestination); if (ctx.world() != null) { this.behavior.repackChunks(); } @@ -440,7 +445,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro } private boolean hasAirBubble(BlockPos pos) { - final int radius = 2; // Half of 5, as we're counting blocks in each direction from the center + final int radius = 4; // Half of the full width, rounded down, as we're counting blocks in each direction from the center BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(); for (int x = -radius; x <= radius; x++) { for (int y = -radius; y <= radius; y++) { diff --git a/src/main/java/baritone/process/elytra/ElytraBehavior.java b/src/main/java/baritone/process/elytra/ElytraBehavior.java index 39af6fc38..211835dda 100644 --- a/src/main/java/baritone/process/elytra/ElytraBehavior.java +++ b/src/main/java/baritone/process/elytra/ElytraBehavior.java @@ -99,6 +99,7 @@ public final class ElytraBehavior implements Helper { private BlockStateInterface bsi; private final BlockStateOctreeInterface boi; public final BlockPos destination; + private final boolean appendDestination; private final ExecutorService solverExecutor; private Future solver; @@ -111,7 +112,7 @@ public final class ElytraBehavior implements Helper { private int invTickCountdown = 0; private final Queue invTransactionQueue = new LinkedList<>(); - public ElytraBehavior(Baritone baritone, ElytraProcess process, BlockPos destination) { + public ElytraBehavior(Baritone baritone, ElytraProcess process, BlockPos destination, boolean appendDestination) { this.baritone = baritone; this.ctx = baritone.getPlayerContext(); this.clearLines = new CopyOnWriteArrayList<>(); @@ -119,6 +120,7 @@ public final class ElytraBehavior implements Helper { this.pathManager = this.new PathManager(); this.process = process; this.destination = destination; + this.appendDestination = appendDestination; this.solverExecutor = Executors.newSingleThreadExecutor(); this.nextTickBoostCounter = new int[2]; @@ -252,7 +254,15 @@ public final class ElytraBehavior implements Helper { } private void setPath(final UnpackedSegment segment) { - this.path = segment.collect(); + List path = segment.collect(); + if (ElytraBehavior.this.appendDestination) { + BlockPos dest = ElytraBehavior.this.destination; + 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)); + } + } + this.path = new NetherPath(path); this.completePath = segment.isFinished(); this.playerNear = 0; this.ticksNearUnchanged = 0; diff --git a/src/main/java/baritone/process/elytra/UnpackedSegment.java b/src/main/java/baritone/process/elytra/UnpackedSegment.java index 02f07feb8..e50ab3235 100644 --- a/src/main/java/baritone/process/elytra/UnpackedSegment.java +++ b/src/main/java/baritone/process/elytra/UnpackedSegment.java @@ -49,7 +49,7 @@ public final class UnpackedSegment { return new UnpackedSegment(Stream.concat(other, this.path), this.finished); } - public NetherPath collect() { + public List collect() { final List path = this.path.collect(Collectors.toList()); // Remove backtracks @@ -67,7 +67,7 @@ public final class UnpackedSegment { } } - return new NetherPath(path); + return path; } public boolean isFinished() {