diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java index ff8fc9f37f..e6c83d1c36 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/ElytraFly.java @@ -183,9 +183,9 @@ public class ElytraFly extends Module { public final Setting pitch40rotationSpeed = sgGeneral.add(new DoubleSetting.Builder() .name("pitch40-rotate-speed") .description("The speed for pitch rotation (degrees per tick)") - .defaultValue(4) + .defaultValue(15) .min(1) - .sliderMax(6) + .sliderMax(20) .visible(() -> flightMode.get() == ElytraFlightModes.Pitch40) .build() ); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Pitch40.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Pitch40.java index e8b62760d2..17bed8ba5a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Pitch40.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Pitch40.java @@ -11,7 +11,7 @@ public class Pitch40 extends ElytraFlightMode { private boolean pitchingDown = true; - private int pitch; + private float pitch; public Pitch40() { super(ElytraFlightModes.Pitch40); @@ -22,18 +22,33 @@ public void onActivate() { if (mc.player.getY() < elytraFly.pitch40upperBounds.get()) { elytraFly.error("Player must be above upper bounds!"); elytraFly.toggle(); + } else if (mc.player.getY() - 40 < elytraFly.pitch40lowerBounds.get()) { + elytraFly.error("Player must be at least 40 blocks above the lower bounds!"); + elytraFly.toggle(); } - pitch = 40; + pitch = 32.0F; } - @Override - public void onDeactivate() {} + /** + * Create a random pitch around `pitch` that is within +/- bound/2 + * @param pitch the input pitch + * @param bound the amount of variance + * @return the changed pitch + */ + private float randPitch(float pitch, float bound) { + return (float) (pitch + (bound * (Math.random() - 0.5))); + } @Override public void onTick() { super.onTick(); + /* + When descending, look at 32-33 deg + When ascending, look up at -49 at 10*pitch speed, then lower at 0.5 deg/tick until at 32-33 + */ + if (pitchingDown && mc.player.getY() <= elytraFly.pitch40lowerBounds.get()) { pitchingDown = false; } @@ -42,15 +57,16 @@ else if (!pitchingDown && mc.player.getY() >= elytraFly.pitch40upperBounds.get() } // Pitch upwards - if (!pitchingDown && mc.player.getPitch() > -40) { - pitch -= elytraFly.pitch40rotationSpeed.get(); + if (!pitchingDown) { + pitch -= randPitch(elytraFly.pitch40rotationSpeed.get().floatValue(), 3.0F); - if (pitch < -40) pitch = -40; + if (pitch < -49.0) { + pitch = -49.0F; + pitchingDown = true; + } // Pitch downwards - } else if (pitchingDown && mc.player.getPitch() < 40) { - pitch += elytraFly.pitch40rotationSpeed.get(); - - if (pitch > 40) pitch = 40; + } else if (pitch < 32.0) { + pitch += randPitch(0.5F, 0.125F); } mc.player.setPitch(pitch);