From 7d30a0e1301dc4ace0a0d00ee96481c3e4223ab2 Mon Sep 17 00:00:00 2001 From: Mana <57663038+Manaball123@users.noreply.github.com> Date: Sun, 3 Sep 2023 00:36:48 +0800 Subject: [PATCH] make yaw lock of bounce efly optional and fixed typo --- .../modules/movement/elytrafly/ElytraFly.java | 21 ++++++++++++++++++- .../movement/elytrafly/modes/Bounce.java | 19 ++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) 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 1fa68637e2..35f20b7a5e 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 @@ -19,6 +19,7 @@ import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.modes.Bounce; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.modes.Vanilla; import meteordevelopment.meteorclient.systems.modules.player.ChestSwap; +import meteordevelopment.meteorclient.systems.modules.player.Rotation; import meteordevelopment.meteorclient.systems.modules.render.Freecam; import meteordevelopment.orbit.EventHandler; import net.minecraft.block.Block; @@ -196,9 +197,17 @@ public class ElytraFly extends Module { .build() ); + public final Setting yawLockMode = sgGeneral.add(new EnumSetting.Builder() + .name("yaw-lock") + .description("Whether to enable yaw lock or not") + .defaultValue(Rotation.LockMode.Smart) + .visible(() -> flightMode.get() == ElytraFlightModes.Bounce) + .build() + ); + public final Setting pitch = sgGeneral.add(new DoubleSetting.Builder() .name("pitch") - .description("The pitch angle to look at when using the recast mode.") + .description("The pitch angle to look at when using the bounce mode.") .defaultValue(85) .range(0, 90) .sliderRange(0, 90) @@ -206,6 +215,16 @@ public class ElytraFly extends Module { .build() ); + public final Setting yaw = sgGeneral.add(new DoubleSetting.Builder() + .name("yaw") + .description("The yaw angle to look at when using simple rotation lock in bounce mode.") + .defaultValue(0) + .range(0, 360) + .sliderRange(0,360) + .visible(() -> flightMode.get() == ElytraFlightModes.Bounce && yawLockMode.get() == Rotation.LockMode.Simple) + .build() + ); + public final Setting restart = sgGeneral.add(new BoolSetting.Builder() .name("restart") .description("Restarts flying with the elytra when rubberbanding.") diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java index 3549f0b969..58e6ee10f5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/elytrafly/modes/Bounce.java @@ -12,6 +12,7 @@ import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.ElytraFlightMode; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.ElytraFlightModes; +import meteordevelopment.meteorclient.systems.modules.player.Rotation; import meteordevelopment.meteorclient.utils.misc.input.Input; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.option.KeyBinding; @@ -47,7 +48,7 @@ public void onTick() { if (prevFov != 0 && !elytraFly.sprint.get()) mc.options.getFovEffectScale().setValue(0.0); // This stops the FOV effects from constantly going on and off. if (elytraFly.autoJump.get()) setPressed(mc.options.jumpKey, true); setPressed(mc.options.forwardKey, true); - mc.player.setYaw(getSmartYawDirection()); + mc.player.setYaw(getYawDirection()); mc.player.setPitch(elytraFly.pitch.get().floatValue()); } @@ -125,8 +126,20 @@ private static boolean ignoreGround(ClientPlayerEntity player) { } else return false; } - private float getSmartYawDirection() { - return Math.round((mc.player.getYaw() + 1f) / 45f) * 45f; + private float getYawDirection() { + switch (elytraFly.yawLockMode.get()) { + case None -> { + return mc.player.getYaw(); + } + case Smart -> { + return Math.round((mc.player.getYaw() + 1f) / 45f) * 45f; + } + case Simple -> { + return elytraFly.yaw.get().floatValue(); + } + }; + throw new IllegalArgumentException("um wtf"); + } @Override