mirror of https://github.com/cabaletta/baritone
Merge branch '1.19.4' into 1.20.1
This commit is contained in:
commit
97067b9078
|
@ -24,6 +24,7 @@ import baritone.api.behavior.look.ITickableAimProcessor;
|
|||
import baritone.api.event.events.*;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.utils.*;
|
||||
import baritone.api.utils.input.Input;
|
||||
import baritone.pathing.movement.MovementHelper;
|
||||
import baritone.process.ElytraProcess;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
|
@ -103,7 +104,7 @@ public final class ElytraBehavior implements Helper {
|
|||
|
||||
private BlockStateInterface bsi;
|
||||
private final BlockStateOctreeInterface boi;
|
||||
public final BlockPos destination;
|
||||
public final BetterBlockPos destination;
|
||||
private final boolean appendDestination;
|
||||
|
||||
private final ExecutorService solverExecutor;
|
||||
|
@ -124,7 +125,7 @@ public final class ElytraBehavior implements Helper {
|
|||
this.blockedLines = new CopyOnWriteArrayList<>();
|
||||
this.pathManager = this.new PathManager();
|
||||
this.process = process;
|
||||
this.destination = destination;
|
||||
this.destination = new BetterBlockPos(destination);
|
||||
this.appendDestination = appendDestination;
|
||||
this.solverExecutor = Executors.newSingleThreadExecutor();
|
||||
this.nextTickBoostCounter = new int[2];
|
||||
|
@ -193,16 +194,16 @@ public final class ElytraBehavior implements Helper {
|
|||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> pathRecalcSegment(final int upToIncl) {
|
||||
public CompletableFuture<Void> pathRecalcSegment(final OptionalInt upToIncl) {
|
||||
if (this.recalculating) {
|
||||
throw new IllegalStateException("already recalculating");
|
||||
}
|
||||
|
||||
this.recalculating = true;
|
||||
final List<BetterBlockPos> after = this.path.subList(upToIncl + 1, this.path.size());
|
||||
final List<BetterBlockPos> after = upToIncl.isPresent() ? this.path.subList(upToIncl.getAsInt() + 1, this.path.size()) : Collections.emptyList();
|
||||
final boolean complete = this.completePath;
|
||||
|
||||
return this.path0(ctx.playerFeet(), this.path.get(upToIncl), segment -> segment.append(after.stream(), complete))
|
||||
return this.path0(ctx.playerFeet(), upToIncl.isPresent() ? this.path.get(upToIncl.getAsInt()) : ElytraBehavior.this.destination, segment -> segment.append(after.stream(), complete || (segment.isFinished() && !upToIncl.isPresent())))
|
||||
.whenComplete((result, ex) -> {
|
||||
this.recalculating = false;
|
||||
if (ex != null) {
|
||||
|
@ -320,7 +321,7 @@ public final class ElytraBehavior implements Helper {
|
|||
}
|
||||
|
||||
if (ElytraBehavior.this.process.state != ElytraProcess.State.LANDING && this.ticksNearUnchanged > 100) {
|
||||
this.pathRecalcSegment(rangeEndExcl - 1)
|
||||
this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1))
|
||||
.thenRun(() -> {
|
||||
logDirect("Recalculating segment, no progress in last 100 ticks");
|
||||
});
|
||||
|
@ -336,15 +337,15 @@ public final class ElytraBehavior implements Helper {
|
|||
if (!ElytraBehavior.this.clearView(this.path.getVec(i), this.path.getVec(i + 1), false)) {
|
||||
// obstacle. where do we return to pathing?
|
||||
// if the end of render distance is closer to goal, then that's fine, otherwise we'd be "digging our hole deeper" and making an already bad backtrack worse
|
||||
int rejoinMainPathAt;
|
||||
if (this.path.get(rangeEndExcl - 1).distanceSq(this.path.get(path.size() - 1)) < ctx.playerFeet().distanceSq(this.path.get(path.size() - 1))) {
|
||||
rejoinMainPathAt = rangeEndExcl - 1; // rejoin after current render distance
|
||||
OptionalInt rejoinMainPathAt;
|
||||
if (this.path.get(rangeEndExcl - 1).distanceSq(ElytraBehavior.this.destination) < ctx.playerFeet().distanceSq(ElytraBehavior.this.destination)) {
|
||||
rejoinMainPathAt = OptionalInt.of(rangeEndExcl - 1); // rejoin after current render distance
|
||||
} else {
|
||||
rejoinMainPathAt = path.size() - 1; // large backtrack detected. ignore render distance, rejoin later on
|
||||
rejoinMainPathAt = OptionalInt.empty(); // large backtrack detected. ignore render distance, rejoin later on
|
||||
}
|
||||
|
||||
final BetterBlockPos blockage = this.path.get(i);
|
||||
final double distance = ctx.playerFeet().distanceTo(this.path.get(rejoinMainPathAt));
|
||||
final double distance = ctx.playerFeet().distanceTo(this.path.get(rejoinMainPathAt.orElse(path.size() - 1)));
|
||||
|
||||
final long start = System.nanoTime();
|
||||
this.pathRecalcSegment(rejoinMainPathAt)
|
||||
|
@ -361,7 +362,7 @@ public final class ElytraBehavior implements Helper {
|
|||
}
|
||||
}
|
||||
if (!canSeeAny && rangeStartIncl < rangeEndExcl - 2 && process.state != ElytraProcess.State.GET_TO_JUMP) {
|
||||
this.pathRecalcSegment(rangeEndExcl - 1).thenRun(() -> logDirect("Recalculated segment since no path points were visible"));
|
||||
this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1)).thenRun(() -> logDirect("Recalculated segment since no path points were visible"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,6 +605,11 @@ public final class ElytraBehavior implements Helper {
|
|||
this.deployedFireworkLastTick = false;
|
||||
}
|
||||
|
||||
final boolean inLava = ctx.player().isInLava();
|
||||
if (inLava) {
|
||||
baritone.getInputOverrideHandler().setInputForceState(Input.JUMP, true);
|
||||
}
|
||||
|
||||
if (solution == null) {
|
||||
logDirect("no solution");
|
||||
return;
|
||||
|
@ -622,7 +628,7 @@ public final class ElytraBehavior implements Helper {
|
|||
solution.context.start,
|
||||
solution.goingTo,
|
||||
solution.context.boost.isBoosted(),
|
||||
solution.forceUseFirework
|
||||
solution.forceUseFirework || inLava
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1004,7 +1010,7 @@ public final class ElytraBehavior implements Helper {
|
|||
// if start == dest then the cpp raytracer dies
|
||||
clear = start.equals(dest) || this.context.raytrace(start, dest);
|
||||
} else {
|
||||
clear = ctx.world().clip(new ClipContext(start, dest, ClipContext.Block.COLLIDER, ClipContext.Fluid.ANY, ctx.player())).getType() == HitResult.Type.MISS;
|
||||
clear = ctx.world().clip(new ClipContext(start, dest, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, ctx.player())).getType() == HitResult.Type.MISS;
|
||||
}
|
||||
|
||||
if (Baritone.settings().elytraRenderRaytraces.value) {
|
||||
|
|
Loading…
Reference in New Issue