Skip to content

Commit

Permalink
make yaw lock of bounce efly optional and fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
4d616e61 authored and Wide-Cat committed Sep 6, 2023
1 parent 1505263 commit 7d30a0e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -196,16 +197,34 @@ public class ElytraFly extends Module {
.build()
);

public final Setting<Rotation.LockMode> yawLockMode = sgGeneral.add(new EnumSetting.Builder<Rotation.LockMode>()
.name("yaw-lock")
.description("Whether to enable yaw lock or not")
.defaultValue(Rotation.LockMode.Smart)
.visible(() -> flightMode.get() == ElytraFlightModes.Bounce)
.build()
);

public final Setting<Double> 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)
.visible(() -> flightMode.get() == ElytraFlightModes.Bounce)
.build()
);

public final Setting<Double> 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<Boolean> restart = sgGeneral.add(new BoolSetting.Builder()
.name("restart")
.description("Restarts flying with the elytra when rubberbanding.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7d30a0e

Please sign in to comment.