From 14c68eb5ba16774f581d95a39e64a7b303954ffc Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Sat, 26 Sep 2026 17:05:36 +1200 Subject: migration to 26.2 - run migrateMappings with old loom then bring it back to new --- .../arslaansmagichax/modules/impl/Flight.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/main/java/com/arslaancodes/arslaansmagichax/modules/impl/Flight.java (limited to 'src/main/java/com/arslaancodes/arslaansmagichax/modules/impl/Flight.java') diff --git a/src/main/java/com/arslaancodes/arslaansmagichax/modules/impl/Flight.java b/src/main/java/com/arslaancodes/arslaansmagichax/modules/impl/Flight.java new file mode 100644 index 0000000..c1a9125 --- /dev/null +++ b/src/main/java/com/arslaancodes/arslaansmagichax/modules/impl/Flight.java @@ -0,0 +1,61 @@ +package com.arslaancodes.arslaansmagichax.modules.impl; + +import com.arslaancodes.arslaansmagichax.modules.Category; +import com.arslaancodes.arslaansmagichax.modules.Module; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; +import org.lwjgl.glfw.GLFW; + +public class Flight extends Module { + private int flyingTickCounter = 0; + private boolean sentFirstPacket = false; + + public Flight() { + super("Flight", "Enables creative flight in survival.", GLFW.GLFW_KEY_G, Category.MOVEMENT); + } + + @Override + protected void onEnable() { + if (mc.player == null) return; + mc.player.displayClientMessage(Component.literal("[Flight] It is recommended to use this hack in combination with NoFall."), false); + } + + @Override + public void tick() { + if (!this.isEnabled() || mc.player == null) return; + + mc.player.getAbilities().mayfly = true; + mc.player.getAbilities().flying = true; + + if (flyingTickCounter >= 20) { + if (!sentFirstPacket) { + sendYPacket(-0.0625); + sentFirstPacket = true; + } else { + sendYPacket(0); + sentFirstPacket = false; + flyingTickCounter = 0; + } + } + flyingTickCounter++; + } + + + @Override + protected void onDisable() { + if (mc.player != null) { + mc.player.getAbilities().mayfly = false; + mc.player.getAbilities().flying = false; + } + } + + private static void sendYPacket(double height) { + double x = mc.player.getX(); + double y = mc.player.getY(); + double z = mc.player.getZ(); + + ServerboundMovePlayerPacket packet = new ServerboundMovePlayerPacket.Pos(x, y + height, z, false, mc.player.horizontalCollision); + + mc.player.connection.send(packet); + } +} -- cgit v1.2.3