From f0148a625e790e155884d2a8ddb2a992c98a4cf4 Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 26 Jun 2023 16:04:05 -0500 Subject: [PATCH] Move `steps` into `solvePitch` --- src/main/java/baritone/behavior/ElytraBehavior.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/behavior/ElytraBehavior.java b/src/main/java/baritone/behavior/ElytraBehavior.java index e1a134725..7deea42b9 100644 --- a/src/main/java/baritone/behavior/ElytraBehavior.java +++ b/src/main/java/baritone/behavior/ElytraBehavior.java @@ -498,7 +498,6 @@ public final class ElytraBehavior extends Behavior implements IElytraBehavior, H for (int relaxation = 0; relaxation < 3; relaxation++) { // try for a strict solution first, then relax more and more (if we're in a corner or near some blocks, it will have to relax its constraints a bit) int[] heights = context.boost.isBoosted() ? new int[]{20, 10, 5, 0} : new int[]{0}; // attempt to gain height, if we can, so as not to waste the boost float[] interps = new float[] {1.0f, 0.75f, 0.5f, 0.25f}; - int steps = relaxation < 2 ? context.boost.isBoosted() ? 5 : Baritone.settings().elytraSimulationTicks.value : 3; int lookahead = relaxation == 0 ? 2 : 3; // ideally this would be expressed as a distance in blocks, rather than a number of voxel steps //int minStep = Math.max(0, playerNear - relaxation); int minStep = playerNear; @@ -539,7 +538,7 @@ public final class ElytraBehavior extends Behavior implements IElytraBehavior, H // Yaw is trivial, just calculate the rotation required to face the destination final float yaw = RotationUtils.calcRotationFromVec3d(start, dest, ctx.playerRotations()).getYaw(); - final Pair pitch = this.solvePitch(context, dest.subtract(start), steps, relaxation, isInLava); + final Pair pitch = this.solvePitch(context, dest.subtract(start), relaxation, isInLava); if (pitch.first() == null) { solution = new Solution(context, new Rotation(yaw, ctx.playerRotations().getPitch()), null, false, false); continue; @@ -790,7 +789,9 @@ public final class ElytraBehavior extends Behavior implements IElytraBehavior, H } } - private Pair solvePitch(SolverContext context, Vec3d goalDelta, int steps, int relaxation, boolean ignoreLava) { + private Pair solvePitch(SolverContext context, Vec3d goalDelta, int relaxation, boolean ignoreLava) { + final int steps = relaxation < 2 ? context.boost.isBoosted() ? 5 : Baritone.settings().elytraSimulationTicks.value : 3; + final Float pitch = this.solvePitch(context, goalDelta, steps, relaxation == 2, context.boost.isBoosted(), ignoreLava); if (pitch != null) { return new Pair<>(pitch, false);