flight module

flight: Minecraft 26.3 cheat module, full source for every implementation (5 clients: Meteor Client, MelaHack (ThunderHack fork), OfflineClient, …).

5 implementationsMovementMOVEMENT

Full module source: 5 implementations

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientMovementsrc/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.javaJava · 275 lines · 10.2 KB

FLYYYY! No Fall is recommended with this module.

Settingsmodespeedvertical-speed-matchno-sneakdelayoff-time
Flight.javaJava · Minecraft 26.2 · 275 lines · 10.2 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.movement;
7
8
import meteordevelopment.meteorclient.events.packets.PacketEvent;
9
import meteordevelopment.meteorclient.events.world.TickEvent;
10
import meteordevelopment.meteorclient.mixin.LocalPlayerAccessor;
11
import meteordevelopment.meteorclient.mixin.ServerboundMovePlayerPacketAccessor;
12
import meteordevelopment.meteorclient.settings.*;
13
import meteordevelopment.meteorclient.systems.modules.Categories;
14
import meteordevelopment.meteorclient.systems.modules.Module;
15
import meteordevelopment.meteorclient.utils.Utils;
16
import meteordevelopment.meteorclient.utils.entity.EntityUtils;
17
import meteordevelopment.orbit.EventHandler;
18
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket;
19
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
20
import net.minecraft.world.phys.Vec3;
21
22
public class Flight extends Module {
23
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
24
    private final SettingGroup sgAntiKick = settings.createGroup("Anti Kick"); //Pog
25
26
    private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
27
        .name("mode")
28
        .description("The mode for Flight.")
29
        .defaultValue(Mode.Abilities)
30
        .onChanged(mode -> {
31
            if (!isActive() || !Utils.canUpdate()) return;
32
            abilitiesOff();
33
        })
34
        .build()
35
    );
36
37
    private final Setting<Double> speed = sgGeneral.add(new DoubleSetting.Builder()
38
        .name("speed")
39
        .description("Your speed when flying.")
40
        .defaultValue(0.1)
41
        .min(0.0)
42
        .build()
43
    );
44
45
    private final Setting<Boolean> verticalSpeedMatch = sgGeneral.add(new BoolSetting.Builder()
46
        .name("vertical-speed-match")
47
        .description("Matches your vertical speed to your horizontal speed, otherwise uses vanilla ratio.")
48
        .defaultValue(false)
49
        .build()
50
    );
51
52
    private final Setting<Boolean> noSneak = sgGeneral.add(new BoolSetting.Builder()
53
        .name("no-sneak")
54
        .description("Prevents you from sneaking while flying.")
55
        .defaultValue(false)
56
        .visible(() -> mode.get() == Mode.Velocity)
57
        .build()
58
    );
59
60
    private final Setting<AntiKickMode> antiKickMode = sgAntiKick.add(new EnumSetting.Builder<AntiKickMode>()
61
        .name("mode")
62
        .description("The mode for anti kick.")
63
        .defaultValue(AntiKickMode.Packet)
64
        .build()
65
    );
66
67
    private final Setting<Integer> delay = sgAntiKick.add(new IntSetting.Builder()
68
        .name("delay")
69
        .description("The amount of delay, in ticks, between flying down a bit and return to original position")
70
        .defaultValue(20)
71
        .min(1)
72
        .sliderMax(200)
73
        .build()
74
    );
75
76
    // Anti Kick
77
    private final Setting<Integer> offTime = sgAntiKick.add(new IntSetting.Builder()
78
        .name("off-time")
79
        .description("The amount of delay, in ticks, to fly down a bit to reset floating ticks.")
80
        .defaultValue(1)
81
        .min(1)
82
        .sliderRange(1, 20)
83
        .build()
84
    );
85
86
    private int delayLeft = delay.get();
87
    private int offLeft = offTime.get();
88
    private boolean flip;
89
    private float lastYaw;
90
    private double lastPacketY = Double.MAX_VALUE;
91
92
    public Flight() {
93
        super(Categories.Movement, "flight", "FLYYYY! No Fall is recommended with this module.");
94
    }
95
96
    @Override
97
    public void onActivate() {
98
        if (mode.get() == Mode.Abilities && !mc.player.isSpectator()) {
99
            mc.player.getAbilities().flying = true;
100
            if (mc.player.getAbilities().instabuild) return;
101
            mc.player.getAbilities().mayfly = true;
102
        }
103
    }
104
105
    @Override
106
    public void onDeactivate() {
107
        if (mode.get() == Mode.Abilities && !mc.player.isSpectator()) {
108
            abilitiesOff();
109
        }
110
    }
111
112
    @EventHandler
113
    private void onPreTick(TickEvent.Pre event) {
114
        float currentYaw = mc.player.getYRot();
115
        if (mc.player.fallDistance >= 3f && currentYaw == lastYaw && mc.player.getDeltaMovement().length() < 0.003d) {
116
            mc.player.setYRot(currentYaw + (flip ? 1 : -1));
117
            flip = !flip;
118
        }
119
        lastYaw = currentYaw;
120
    }
121
122
    @EventHandler
123
    private void onPostTick(TickEvent.Post event) {
124
        if (delayLeft > 0) delayLeft--;
125
126
        if (offLeft <= 0 && delayLeft <= 0) {
127
            delayLeft = delay.get();
128
            offLeft = offTime.get();
129
130
            if (antiKickMode.get() == AntiKickMode.Packet) {
131
                // Resend movement packets
132
                ((LocalPlayerAccessor) mc.player).meteor$setPositionReminder(20);
133
            }
134
        } else if (delayLeft <= 0) {
135
            boolean shouldReturn = false;
136
137
            if (antiKickMode.get() == AntiKickMode.Normal) {
138
                if (mode.get() == Mode.Abilities) {
139
                    abilitiesOff();
140
                    shouldReturn = true;
141
                }
142
            } else if (antiKickMode.get() == AntiKickMode.Packet && offLeft == offTime.get()) {
143
                // Resend movement packets
144
                ((LocalPlayerAccessor) mc.player).meteor$setPositionReminder(20);
145
            }
146
147
            offLeft--;
148
149
            if (shouldReturn) return;
150
        }
151
152
        if (mc.player.getYRot() != lastYaw) mc.player.setYRot(lastYaw);
153
154
        switch (mode.get()) {
155
            case Velocity -> {
156
                mc.player.getAbilities().flying = false;
157
                mc.player.setDeltaMovement(0, 0, 0);
158
                Vec3 playerVelocity = mc.player.getDeltaMovement();
159
                if (mc.options.keyJump.isDown())
160
                    playerVelocity = playerVelocity.add(0, speed.get() * (verticalSpeedMatch.get() ? 10f : 5f), 0);
161
                if (mc.options.keyShift.isDown())
162
                    playerVelocity = playerVelocity.subtract(0, speed.get() * (verticalSpeedMatch.get() ? 10f : 5f), 0);
163
                mc.player.setDeltaMovement(playerVelocity);
164
                if (noSneak.get()) {
165
                    mc.player.setOnGround(false);
166
                }
167
            }
168
            case Abilities -> {
169
                if (mc.player.isSpectator()) return;
170
                mc.player.getAbilities().setFlyingSpeed(speed.get().floatValue());
171
                mc.player.getAbilities().flying = true;
172
                if (mc.player.getAbilities().instabuild) return;
173
                mc.player.getAbilities().mayfly = true;
174
            }
175
        }
176
    }
177
178
    private void antiKickPacket(ServerboundMovePlayerPacket packet, double currentY) {
179
        // maximum time we can be "floating" is 80 ticks, so 4 seconds max
180
        if (this.delayLeft <= 0 && this.lastPacketY != Double.MAX_VALUE &&
181
            shouldFlyDown(currentY, this.lastPacketY) && EntityUtils.isOnAir(mc.player)) {
182
            // actual check is for >= -0.03125D, but we have to do a bit more than that
183
            // due to the fact that it's a bigger or *equal* to, and not just a bigger than
184
            ((ServerboundMovePlayerPacketAccessor) packet).meteor$setY(lastPacketY - 0.03130D);
185
        } else {
186
            lastPacketY = currentY;
187
        }
188
    }
189
190
    /**
191
     * @see net.minecraft.network.protocol.game.ServerGamePacketListener#handleMovePlayer(ServerboundMovePlayerPacket)
192
     */
193
    @EventHandler
194
    private void onSendPacket(PacketEvent.Send event) {
195
        if (!(event.packet instanceof ServerboundMovePlayerPacket packet) || antiKickMode.get() != AntiKickMode.Packet)
196
            return;
197
198
        double currentY = packet.getY(Double.MAX_VALUE);
199
        if (currentY != Double.MAX_VALUE) {
200
            antiKickPacket(packet, currentY);
201
        } else {
202
            // if the packet is a Rot packet or an StatusOnly packet then we need to
203
            // make it a PosRot packet or a Pos packet respectively, so it has a Y value
204
            ServerboundMovePlayerPacket fullPacket;
205
            if (packet.hasRotation()) {
206
                fullPacket = new ServerboundMovePlayerPacket.PosRot(
207
                    mc.player.getX(),
208
                    mc.player.getY(),
209
                    mc.player.getZ(),
210
                    packet.getYRot(0),
211
                    packet.getXRot(0),
212
                    packet.isOnGround(),
213
                    mc.player.horizontalCollision
214
                );
215
            } else {
216
                fullPacket = new ServerboundMovePlayerPacket.Pos(
217
                    mc.player.getX(),
218
                    mc.player.getY(),
219
                    mc.player.getZ(),
220
                    packet.isOnGround(),
221
                    mc.player.horizontalCollision
222
                );
223
            }
224
            event.cancel();
225
            antiKickPacket(fullPacket, mc.player.getY());
226
            mc.getConnection().send(fullPacket);
227
        }
228
    }
229
230
    @EventHandler
231
    private void onReceivePacket(PacketEvent.Receive event) {
232
        if (!(event.packet instanceof ClientboundPlayerAbilitiesPacket packet) || mode.get() != Mode.Abilities) return;
233
        event.cancel(); // Cancel packet, so fly won't be toggled
234
235
        mc.player.getAbilities().invulnerable = packet.isInvulnerable();
236
        mc.player.getAbilities().instabuild = packet.canInstabuild();
237
        mc.player.getAbilities().setWalkingSpeed(packet.getWalkingSpeed());
238
    }
239
240
    private boolean shouldFlyDown(double currentY, double lastY) {
241
        if (currentY >= lastY) {
242
            return true;
243
        } else return lastY - currentY < 0.03130D;
244
    }
245
246
    private void abilitiesOff() {
247
        mc.player.getAbilities().flying = false;
248
        mc.player.getAbilities().setFlyingSpeed(0.05f);
249
        if (mc.player.getAbilities().instabuild) return;
250
        mc.player.getAbilities().mayfly = false;
251
    }
252
253
    public float getFlyingSpeed() {
254
        // All the multiplication below is to get the speed to roughly match the speed you get when using vanilla fly
255
256
        if (!isActive() || mode.get() != Mode.Velocity) return -1;
257
        return speed.get().floatValue() * (mc.player.isSprinting() ? 15f : 10f);
258
    }
259
260
    public boolean noSneak() {
261
        return isActive() && mode.get() == Mode.Velocity && noSneak.get();
262
    }
263
264
    public enum Mode {
265
        Abilities,
266
        Velocity
267
    }
268
269
    public enum AntiKickMode {
270
        Normal,
271
        Packet,
272
        None
273
    }
274
}
275
MelaHack (ThunderHack fork)MOVEMENTsrc/main/java/thunder/hack/features/modules/movement/Flight.javaJava · 157 lines · 6.8 KB

Allows you to fly.

SettingsModeHorizontalVerticalBoostAutoToggleTicksAntiKick
Flight.javaJava · Minecraft 26.2 · 157 lines · 6.8 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.movement;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.ChatFormatting;
5
import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket;
6
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
7
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
8
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
9
import thunder.hack.events.impl.EventSync;
10
import thunder.hack.events.impl.PacketEvent;
11
import thunder.hack.features.modules.Module;
12
import thunder.hack.setting.Setting;
13
import thunder.hack.utility.player.MovementUtility;
14
15
import static thunder.hack.features.modules.client.ClientSettings.isRu;
16
17
public class Flight extends Module {
18
    public Flight() {
19
        super("Flight", Category.MOVEMENT);
20
    }
21
22
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.Vanilla);
23
    private final Setting<Float> hSpeed = new Setting<>("Horizontal", 1f, 0.0f, 10.0f, v -> !mode.is(Mode.StormBreak));
24
    private final Setting<Float> vSpeed = new Setting<>("Vertical", 0.78F, 0.0F, 5F, v -> !mode.is(Mode.StormBreak));
25
    private final Setting<Float> boostValue = new Setting<>("Boost", 1f, 0.1F, 1f, v -> mode.is(Mode.StormBreak));
26
    private final Setting<Boolean> autoToggle = new Setting<>("AutoToggle", false, v -> mode.is(Mode.MatrixJump));
27
    private final Setting<Integer> boostTicks = new Setting<>("Ticks", 8, 0, 40, v -> mode.is(Mode.Damage));
28
    private final Setting<Boolean> antiKick = new Setting<>("AntiKick", false, v -> mode.is(Mode.Creative) || mode.is(Mode.Vanilla));
29
30
    private double prevX, prevY, prevZ, velocityMotion;
31
    public boolean onPosLook = false;
32
    private int flyTicks = 0;
33
34
35
    @EventHandler
36
    public void onEventSync(EventSync event) {
37
        switch (mode.getValue()) {
38
            case Vanilla -> {
39
                if (MovementUtility.isMoving()) {
40
                    final double[] dir = MovementUtility.forward(hSpeed.getValue());
41
                    mc.player.setDeltaMovement(dir[0], 0, dir[1]);
42
                } else mc.player.setDeltaMovement(0, 0, 0);
43
44
                if (mc.options.keyJump.isDown())
45
                    mc.player.setDeltaMovement(mc.player.getDeltaMovement().add(0, vSpeed.getValue(), 0));
46
                if (mc.options.keyShift.isDown())
47
                    mc.player.setDeltaMovement(mc.player.getDeltaMovement().add(0, -vSpeed.getValue(), 0));
48
            }
49
50
            case AirJump -> {
51
                if (MovementUtility.isMoving() && mc.level.getBlockCollisions(mc.player, mc.player.getBoundingBox().inflate(0.5, 0.0, 0.5).move(0.0, -1.0, 0.0)).iterator().hasNext()) {
52
                    mc.player.setOnGround(true);
53
                    mc.player.jumpFromGround();
54
                }
55
            }
56
57
            case MatrixGlide -> {
58
                if (mc.player.onGround()) {
59
                    mc.player.jumpFromGround();
60
                    flyTicks = 5;
61
                } else if (flyTicks > 0) {
62
                    if (MovementUtility.isMoving()) {
63
                        final double[] dir = MovementUtility.forward(hSpeed.getValue());
64
                        mc.player.setDeltaMovement(dir[0], -0.04, dir[1]);
65
                    } else mc.player.setDeltaMovement(0, -0.04, 0);
66
                    flyTicks--;
67
                }
68
            }
69
70
            case StormBreak -> {
71
                if (mc.player.tickCount % 60 == 0)
72
                    sendMessage(ChatFormatting.RED + (isRu() ? "В этом режиме нужно ломать блоки!" : "In this mode you need to break blocks!"));
73
            }
74
        }
75
76
        if (antiKick.getValue() && (mode.is(Mode.Creative) || mode.is(Mode.Vanilla)))
77
            mc.player.setDeltaMovement(mc.player.getDeltaMovement().add(0, -0.08, 0));
78
    }
79
80
    @Override
81
    public void onUpdate() {
82
        if (mode.is(Mode.Damage))
83
            if (flyTicks-- > boostTicks.getValue())
84
                mc.player.setDeltaMovement(mc.player.getDeltaMovement().x, velocityMotion, mc.player.getDeltaMovement().z());
85
86
        if (mode.is(Mode.MatrixJump)) {
87
            if (mc.player.fallDistance == 0)
88
                return;
89
90
            mc.player.getAbilities().flying = false;
91
            mc.player.setDeltaMovement(0.0, 0.0, 0.0);
92
93
            if (mc.options.keyJump.isDown())
94
                mc.player.setDeltaMovement(mc.player.getDeltaMovement().add(0, vSpeed.getValue(), 0));
95
96
            if (mc.options.keyShift.isDown())
97
                mc.player.setDeltaMovement(mc.player.getDeltaMovement().add(0, -vSpeed.getValue(), 0));
98
99
            final double[] dir = MovementUtility.forward(hSpeed.getValue());
100
            mc.player.setDeltaMovement(dir[0], mc.player.getDeltaMovement().y(), dir[1]);
101
        }
102
103
        if (mode.is(Mode.Creative)) {
104
            mc.player.getAbilities().flying = true;
105
            mc.player.getAbilities().setFlyingSpeed(hSpeed.getValue() / 10f);
106
        }
107
    }
108
109
    @EventHandler
110
    public void onPacketReceive(PacketEvent.Receive e) {
111
        if (mode.is(Mode.MatrixJump)) {
112
            if (fullNullCheck()) return;
113
            if (e.getPacket() instanceof ClientboundPlayerPositionPacket) {
114
                onPosLook = true;
115
                prevX = mc.player.getDeltaMovement().x();
116
                prevY = mc.player.getDeltaMovement().y();
117
                prevZ = mc.player.getDeltaMovement().z();
118
            }
119
        }
120
121
        if (mode.is(Mode.Damage))
122
            if (e.getPacket() instanceof ClientboundSetEntityMotionPacket v)
123
                if (v.movement().y > 0.2) {
124
                    velocityMotion = v.movement().y;
125
                    flyTicks = boostTicks.getValue();
126
                }
127
    }
128
129
    @EventHandler
130
    public void onPacketSend(PacketEvent.Send e) {
131
        if (mode.is(Mode.MatrixJump)) {
132
            if (e.getPacket() instanceof ServerboundMovePlayerPacket.PosRot) {
133
                if (onPosLook) {
134
                    mc.player.setDeltaMovement(prevX, prevY, prevZ);
135
                    onPosLook = false;
136
                    if (autoToggle.getValue()) disable();
137
                }
138
            }
139
        }
140
141
        if (mode.is(Mode.StormBreak) && e.getPacket() instanceof ServerboundPlayerActionPacket pac && (pac.getAction() == ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK
142
                || pac.getAction() == ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK && mc.level.getBlockState(pac.getPos()).canBeReplaced())) {
143
            final double[] dir = MovementUtility.forward(2.0f * boostValue.getValue());
144
            mc.player.setDeltaMovement(dir[0], 3f * boostValue.getValue(), dir[1]);
145
        }
146
    }
147
148
    @Override
149
    public void onDisable() {
150
        mc.player.getAbilities().flying = false;
151
        mc.player.getAbilities().setFlyingSpeed(0.05f);
152
    }
153
154
    private enum Mode {
155
        Vanilla, MatrixJump, AirJump, MatrixGlide, StormBreak, Damage, Creative
156
    }
157
}
OfflineClientMOVEMENTsrc/main/java/com/jellypudding/offlineclient/modules/movement/Flight.javaJava · 240 lines · 10.0 KB

Lets you fly like in creative mode.

SettingsModeHorizontal speedVertical speedScroll to change speedTimerThrough fluidsHold abilitiesAntiKickKick intervalDip ticks
Flight.javaJava · Minecraft 26.2 · 240 lines · 10.0 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.movement;
2
3
import com.jellypudding.offlineclient.OfflineClient;
4
import com.jellypudding.offlineclient.event.Subscribe;
5
import com.jellypudding.offlineclient.event.events.ClientTickEvent;
6
import com.jellypudding.offlineclient.event.events.MouseScrollEvent;
7
import com.jellypudding.offlineclient.event.events.PacketReceiveEvent;
8
import com.jellypudding.offlineclient.event.events.PacketSendEvent;
9
import com.jellypudding.offlineclient.event.events.TickEvent;
10
import com.jellypudding.offlineclient.module.Category;
11
import com.jellypudding.offlineclient.module.Module;
12
import com.jellypudding.offlineclient.modules.misc.Timer;
13
import com.jellypudding.offlineclient.setting.BoolSetting;
14
import com.jellypudding.offlineclient.setting.EnumSetting;
15
import com.jellypudding.offlineclient.setting.NumberSetting;
16
import com.jellypudding.offlineclient.util.HoverDip;
17
import com.jellypudding.offlineclient.util.MovementUtil;
18
import com.jellypudding.offlineclient.util.PacketUtil;
19
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket;
20
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
21
import net.minecraft.world.entity.player.Abilities;
22
import net.minecraft.world.phys.Vec3;
23
24
public final class Flight extends Module {
25
26
    public enum Mode { CREATIVE, DIRECT }
27
    public enum AntiKick { DIP, PACKET, OFF }
28
29
    // How much one wheel notch changes the speed.
30
    private static final double SCROLL_STEP = 0.1;
31
32
    private static final String TIMER_KEY = "flight";
33
34
    // The server stops counting hover ticks on a packet that drops past 0.03125.
35
    private static final double PACKET_DIP = 0.0313;
36
37
    private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
38
        "How the flight handles.", Mode.CREATIVE)
39
        .describe(Mode.CREATIVE, "Flies like creative mode. Eases in and drifts to a stop.")
40
        .describe(Mode.DIRECT, "Moves the instant you press a key and stops dead when you let go.");
41
    private final NumberSetting horizontalSpeed = new NumberSetting("Horizontal speed",
42
        "Speed along the ground. 1 matches creative flight.", 1, 0.1, 10, 0.1, "x").min(0.1);
43
    private final NumberSetting verticalSpeed = new NumberSetting("Vertical speed",
44
        "Up and down speed. 1 matches creative flight.", 1, 0.1, 10, 0.1, "x").min(0.1);
45
    private final BoolSetting scrollSpeed = new BoolSetting("Scroll to change speed",
46
        "The mouse wheel changes the horizontal speed whilst you fly.", false);
47
    private final NumberSetting timer = new NumberSetting("Timer",
48
        "Also speeds up the game whilst you fly. 1 does nothing.", 1, 1, 3, 0.1, "x").min(1);
49
    private final BoolSetting throughFluids = new BoolSetting("Through fluids",
50
        "Water and lava neither slow you down nor put you in the swimming pose.", true);
51
    private final BoolSetting holdAbilities = new BoolSetting("Hold abilities",
52
        "Stops a server ability update from flicking the flight off for a tick.", true)
53
        .under(mode, Mode.CREATIVE);
54
    private final EnumSetting<AntiKick> antiKick = new EnumSetting<>("AntiKick",
55
        "How the vanilla flight kick is dodged.", AntiKick.DIP)
56
        .describe(AntiKick.DIP, "Drifts down a little now and then and climbs straight back.")
57
        .describe(AntiKick.PACKET, "Tells the server you dipped whilst you stay put. Needs air below you.")
58
        .describe(AntiKick.OFF, "Does nothing about the kick.");
59
    private final NumberSetting antiKickInterval = new NumberSetting("Kick interval",
60
        "Ticks between each little dip.", 70, 5, 80, 1, " ticks").min(1)
61
        .under(antiKick, AntiKick.DIP, AntiKick.PACKET);
62
    private final NumberSetting dipTicks = new NumberSetting("Dip ticks",
63
        "How many ticks each dip lasts before the climb back.", 1, 1, 20, 1, " ticks").min(1)
64
        .under(antiKick, AntiKick.DIP);
65
66
    private final HoverDip dip = new HoverDip();
67
68
    // Ticks since the last packet dip and whether the real height still has to go back out.
69
    private int packetTicks;
70
    private volatile boolean restorePending;
71
72
    public Flight() {
73
        super("Flight", "Lets you fly like in creative mode.", Category.MOVEMENT);
74
        addSettings(mode, horizontalSpeed, verticalSpeed, scrollSpeed, timer, throughFluids,
75
            holdAbilities, antiKick, antiKickInterval, dipTicks);
76
        searchTags("fly");
77
    }
78
79
    @Override
80
    public String getSuffix() {
81
        return horizontalSpeed.getValueString();
82
    }
83
84
    // Read by LocalPlayerMixin instead of the fly speed creative flight pushes with.
85
    // The horizontal setting must not leak into it.
86
    public float verticalFlySpeed() {
87
        return (float) (MovementUtil.VANILLA_FLY_SPEED * verticalSpeed.getValue());
88
    }
89
90
    // Read by EntityMixin. Fluids stop counting as fluids for the local player.
91
    public boolean throughFluids() {
92
        return throughFluids.isOn();
93
    }
94
95
    @Override
96
    protected void onEnable() {
97
        dip.reset();
98
        packetTicks = 0;
99
        restorePending = false;
100
    }
101
102
    @Override
103
    protected void onDisable() {
104
        Timer.override(TIMER_KEY, 1f);
105
        if (mc.player == null) {
106
            return;
107
        }
108
        Abilities abilities = mc.player.getAbilities();
109
        abilities.setFlyingSpeed(MovementUtil.VANILLA_FLY_SPEED);
110
        if (!mc.player.isCreative() && !mc.player.isSpectator()) {
111
            abilities.flying = false;
112
        }
113
    }
114
115
    // TickEvent stops at a disconnect. ClientTickEvent still runs in the menus.
116
    @Subscribe
117
    private void onClientTick(ClientTickEvent event) {
118
        if (!inGame()) {
119
            Timer.override(TIMER_KEY, 1f);
120
        }
121
    }
122
123
    @Subscribe
124
    private void onScroll(MouseScrollEvent event) {
125
        if (!scrollSpeed.isOn() || !inGame()) {
126
            return;
127
        }
128
        double step = event.getAmount() > 0 ? SCROLL_STEP : -SCROLL_STEP;
129
        // Snapped to the step. The value then reads cleanly after a long scroll.
130
        double next = Math.round((horizontalSpeed.getValue() + step) / SCROLL_STEP) * SCROLL_STEP;
131
        horizontalSpeed.setValue(Math.max(horizontalSpeed.getHardMin(), next));
132
        OfflineClient.INSTANCE.getConfigManager().saveSoon();
133
        event.cancel();
134
    }
135
136
    @Subscribe
137
    private void onTick(TickEvent event) {
138
        if (!inGame()) {
139
            return;
140
        }
141
        boolean moving = MovementUtil.inputDirection().lengthSqr() > 0
142
            || mc.options.keyJump.isDown() || mc.options.keyShift.isDown();
143
        Timer.override(TIMER_KEY, moving ? timer.getFloat() : 1f);
144
145
        if (mode.is(Mode.CREATIVE)) {
146
            creativeTick();
147
        } else {
148
            directTick();
149
        }
150
        switch (antiKick.getValue()) {
151
            case DIP -> dip.tick(antiKickInterval.getInt(), dipTicks.getInt());
152
            case PACKET -> packetDipTick();
153
            case OFF -> { }
154
        }
155
    }
156
157
    private void creativeTick() {
158
        Abilities abilities = mc.player.getAbilities();
159
        abilities.flying = true;
160
        abilities.setFlyingSpeed((float) (MovementUtil.VANILLA_FLY_SPEED * horizontalSpeed.getValue()));
161
    }
162
163
    private void directTick() {
164
        Abilities abilities = mc.player.getAbilities();
165
        // The flying flag turns gravity off and zero speed disables the vanilla push.
166
        abilities.flying = true;
167
        abilities.setFlyingSpeed(0);
168
169
        double vertical = MovementUtil.FLY_VERTICAL * verticalSpeed.getValue();
170
        double vy = 0;
171
        if (mc.options.keyJump.isDown()) {
172
            vy += vertical;
173
        }
174
        if (mc.options.keyShift.isDown()) {
175
            vy -= vertical;
176
        }
177
178
        double horizontal = MovementUtil.FLY_HORIZONTAL * horizontalSpeed.getValue();
179
        Vec3 heading = MovementUtil.inputDirection();
180
        mc.player.setDeltaMovement(heading.x * horizontal, vy, heading.z * horizontal);
181
    }
182
183
    // Sends the dip itself once the interval is up. Waiting for the client's own
184
    // packet is no good since a still player only sends one every twenty ticks.
185
    // A dip into a block would be refused by the server. It waits for air.
186
    private void packetDipTick() {
187
        if (restorePending) {
188
            // Nothing carried the real height back last tick.
189
            restorePending = false;
190
            sendHeight(mc.player.getY());
191
            return;
192
        }
193
        packetTicks++;
194
        if (packetTicks < antiKickInterval.getInt()) {
195
            return;
196
        }
197
        if (!mc.level.noCollision(mc.player, mc.player.getBoundingBox().move(0, -PACKET_DIP, 0))) {
198
            return;
199
        }
200
        packetTicks = 0;
201
        sendHeight(mc.player.getY() - PACKET_DIP);
202
        restorePending = true;
203
    }
204
205
    private void sendHeight(double y) {
206
        mc.player.connection.send(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), y,
207
            mc.player.getZ(), mc.player.onGround(), mc.player.horizontalCollision));
208
    }
209
210
    // The client's own packet after a dip carries the real height back.
211
    // One without a position is upgraded to hold it.
212
    @Subscribe
213
    private void onPacketSend(PacketSendEvent event) {
214
        if (!restorePending || mc.player == null
215
            || !(event.getPacket() instanceof ServerboundMovePlayerPacket packet)) {
216
            return;
217
        }
218
        restorePending = false;
219
        if (!packet.hasPosition()) {
220
            event.setPacket(PacketUtil.withPosition(packet, mc.player, mc.player.getX(),
221
                mc.player.getY(), mc.player.getZ(), packet.isOnGround()));
222
        }
223
    }
224
225
    // Fired on the netty thread. The server may not switch the flight off.
226
    // The rest of what the packet carries still lands.
227
    @Subscribe
228
    private void onPacketReceive(PacketReceiveEvent event) {
229
        if (!holdAbilities.isOn() || !mode.is(Mode.CREATIVE) || mc.player == null
230
            || !(event.getPacket() instanceof ClientboundPlayerAbilitiesPacket packet)) {
231
            return;
232
        }
233
        event.cancel();
234
        Abilities abilities = mc.player.getAbilities();
235
        abilities.invulnerable = packet.isInvulnerable();
236
        abilities.instabuild = packet.canInstabuild();
237
        abilities.setWalkingSpeed(packet.getWalkingSpeed());
238
    }
239
}
240
CombatantMOVEMENTsrc/main/java/combatant/client/features/module/modules/movement/Flight.javaJava · 460 lines · 15.8 KB
Settingsmodespeedvertical_speed_matchno_sneakanti_kick_modeanti_kick_delayanti_kick_off_time
Flight.javaJava · Minecraft 26.2 · 460 lines · 15.8 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Combatant Client distribution.
3
 * Combatant modifications copyright (c) 2026 pivosos2007.
4
 *
5
 * Portions of this file are based on, adapted from, or implemented
6
 * with reference to Meteor Client
7
 * (https://github.com/MeteorDevelopment/meteor-client).
8
 * Copyright (c) Meteor Development.
9
 *
10
 * Licensed under the GNU General Public License v3.0.
11
 * See THIRD_PARTY_NOTICES.md for details.
12
 */
13
14
package combatant.client.features.module.modules.movement;
15
16
import combatant.client.events.impl.*;
17
import net.minecraft.client.Minecraft;
18
import net.minecraft.client.player.LocalPlayer;
19
import net.minecraft.core.BlockPos;
20
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket;
21
import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket;
22
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
23
import net.minecraft.world.level.block.Blocks;
24
import net.minecraft.world.phys.Vec3;
25
import combatant.client.config.values.BooleanValue;
26
import combatant.client.config.values.EnumValue;
27
import combatant.client.config.values.NumberValue;
28
import combatant.client.events.EventHandler;
29
import combatant.client.events.impl.*;
30
import combatant.client.features.module.Module;
31
import combatant.client.features.module.ModuleCategory;
32
import combatant.client.features.module.ModuleInfo;
33
import combatant.client.mixins.accessors.LocalPlayerAccessor;
34
import combatant.client.mixins.accessors.ServerboundMovePlayerPacketAccessor;
35
import combatant.client.util.player.MovementUtil;
36
37
//todo Description
38
@ModuleInfo(
39
        id = "flight",
40
        displayName = "Flight",
41
        category = ModuleCategory.MOVEMENT
42
)
43
public class Flight extends Module {
44
45
    private final EnumValue<Mode> mode =
46
            enumMode("mode", Mode.ABILITIES, Mode.values());
47
    private final NumberValue<Double> speed =
48
            visibleWhen(num("speed", 0.1, 0.0, 5.0), this::usesSpeed);
49
    private final BooleanValue verticalSpeedMatch =
50
            visibleWhen(bool("vertical_speed_match", false), () -> mode.get() == Mode.VELOCITY);
51
    private final BooleanValue noSneak =
52
            visibleWhen(bool("no_sneak", false), () -> mode.get() == Mode.VELOCITY);
53
    private final EnumValue<AntiKickMode> antiKickMode =
54
            visibleWhen(enumMode("anti_kick_mode", AntiKickMode.PACKET, AntiKickMode.values()), this::supportsAntiKick);
55
    private final NumberValue<Integer> delay =
56
            visibleWhen(num("anti_kick_delay", 20, 1, 200), this::supportsAntiKick);
57
    private int delayLeft = delay.get();
58
    private final NumberValue<Integer> offTime =
59
            visibleWhen(num("anti_kick_off_time", 1, 1, 20), this::supportsAntiKick);
60
    private int offLeft = offTime.get();
61
    private boolean flip;
62
    private float lastYaw;
63
    private double lastPacketY = Double.MAX_VALUE;
64
    private Mode lastMode = mode.get();
65
    private int vulcanFlags;
66
    private boolean vulcanWait;
67
    private int grimTicks;
68
69
    @Override
70
    public void onEnable() {
71
        Minecraft mc = Minecraft.getInstance();
72
        if (mc == null || mc.player == null) return;
73
74
        resetModeState();
75
76
        if (mode.get() == Mode.ABILITIES && !mc.player.isSpectator()) {
77
            mc.player.getAbilities().flying = true;
78
            if (!mc.player.getAbilities().instabuild) {
79
                mc.player.getAbilities().mayfly = true;
80
            }
81
        }
82
83
        if (mode.get() == Mode.VULCAN_286_113) {
84
            mc.player.connection.send(new ServerboundMovePlayerPacket.Pos(
85
                    mc.player.getX(),
86
                    mc.player.getY() - 0.1,
87
                    mc.player.getZ(),
88
                    mc.player.onGround(),
89
                    mc.player.horizontalCollision
90
            ));
91
        }
92
93
        lastMode = mode.get();
94
    }
95
96
    @Override
97
    public void onDisable() {
98
        Minecraft mc = Minecraft.getInstance();
99
        if (mc == null || mc.player == null) return;
100
        if (mode.get() == Mode.ABILITIES && !mc.player.isSpectator()) {
101
            abilitiesOff();
102
        }
103
        resetModeState();
104
    }
105
106
    @EventHandler
107
    private void onGameTick(GameTickEvent event) {
108
        Minecraft mc = Minecraft.getInstance();
109
        if (mc == null || mc.player == null) return;
110
111
        syncModeChange();
112
113
        if (isMeteorMode()) {
114
            tickMeteorMode(mc);
115
            return;
116
        }
117
118
        LocalPlayer player = mc.player;
119
        switch (mode.get()) {
120
            case AIRWALK -> {
121
                if (player.getDeltaMovement().y < 0.0 && !mc.options.keyJump.isDown() && !mc.options.keyShift.isDown()) {
122
                    player.setDeltaMovement(player.getDeltaMovement().x, 0.0, player.getDeltaMovement().z);
123
                }
124
            }
125
            case VULCAN_277 -> {
126
                if (player.fallDistance > 0.1f) {
127
                    Vec3 vel = player.getDeltaMovement();
128
                    player.setDeltaMovement(vel.x, player.tickCount % 2 == 0 ? -0.155 : -0.1, vel.z);
129
                }
130
            }
131
            case GRIM_2859_V -> {
132
                if (grimTicks == 0 && player.onGround()) {
133
                    player.jumpFromGround();
134
                }
135
                grimTicks++;
136
            }
137
            default -> {
138
            }
139
        }
140
    }
141
142
    @EventHandler
143
    private void onMove(PlayerMoveEvent event) {
144
        Minecraft mc = Minecraft.getInstance();
145
        if (mc == null || mc.player == null) return;
146
        if (event.getType() != net.minecraft.world.entity.MoverType.SELF) return;
147
148
        switch (mode.get()) {
149
            case SPARTAN_524 -> {
150
                double yaw = Math.toRadians(mc.player.getYRot());
151
                event.setMovement(new Vec3(
152
                        -Math.sin(yaw) * 0.28,
153
                        0.0,
154
                        Math.cos(yaw) * 0.28
155
                ));
156
            }
157
            case AIRWALK -> {
158
                Vec3 movement = event.getMovement();
159
                if (movement != null && movement.y < 0.0) {
160
                    event.setMovement(new Vec3(movement.x, 0.0, movement.z));
161
                }
162
            }
163
            default -> {
164
            }
165
        }
166
    }
167
168
    @EventHandler
169
    private void onCollision(EventCollision event) {
170
        Minecraft mc = Minecraft.getInstance();
171
        if (mc == null || mc.player == null) return;
172
173
        BlockPos below = BlockPos.containing(mc.player.position()).below();
174
        boolean spoofBelow = event.getPos().equals(below) && !mc.options.keyShift.isDown();
175
176
        switch (mode.get()) {
177
            case AIRWALK, VULCAN_286_113, VULCAN_286_18 -> {
178
                if (spoofBelow) {
179
                    event.setState(Blocks.BARRIER.defaultBlockState());
180
                }
181
            }
182
            default -> {
183
            }
184
        }
185
    }
186
187
    @EventHandler
188
    private void onPacketReceive(PacketEvent.Receive event) {
189
        if (!(event.getPacket() instanceof ClientboundPlayerPositionPacket)) return;
190
191
        switch (mode.get()) {
192
            case VULCAN_286_113, VULCAN_286_18 -> {
193
                vulcanFlags++;
194
                if (vulcanFlags == 1) {
195
                    vulcanWait = true;
196
                    event.cancel();
197
                } else {
198
                    setEnabled(false);
199
                }
200
            }
201
            default -> {
202
            }
203
        }
204
    }
205
206
    @EventHandler
207
    private void onPacketSend(PacketEvent.Send event) {
208
        if (!(event.getPacket() instanceof ServerboundMovePlayerPacket packet)) return;
209
210
        switch (mode.get()) {
211
            case AIRWALK, VULCAN_286_18 -> ((ServerboundMovePlayerPacketAccessor) packet).combatant$setOnGround(true);
212
            case VULCAN_286_113 -> {
213
                if (vulcanWait) {
214
                    ((ServerboundMovePlayerPacketAccessor) packet).combatant$setOnGround(false);
215
                }
216
            }
217
            default -> {
218
            }
219
        }
220
    }
221
222
    @EventHandler
223
    private void onSync(EventSync event) {
224
        Minecraft mc = Minecraft.getInstance();
225
        LocalPlayer player = mc != null ? mc.player : null;
226
        if (player == null) return;
227
228
        if (mode.get() == Mode.GRIM_2859_V && grimTicks >= 2) {
229
            Vec3 original = player.position();
230
            player.setPos(original.x + 1152.0, original.y, original.z + 1152.0);
231
            event.addPostAction(() -> player.setPos(original.x, original.y, original.z));
232
        }
233
    }
234
235
    public ServerboundMovePlayerPacket onSendMovePacket(ServerboundMovePlayerPacket packet) {
236
        if (packet == null) return null;
237
        if (!isMeteorMode() || antiKickMode.get() != AntiKickMode.PACKET) return null;
238
239
        Minecraft mc = Minecraft.getInstance();
240
        if (mc == null || mc.player == null) return null;
241
242
        double currentY = packet.getY(Double.MAX_VALUE);
243
        if (currentY != Double.MAX_VALUE) {
244
            antiKickPacket(packet, currentY);
245
            return null;
246
        }
247
248
        ServerboundMovePlayerPacket fullPacket;
249
        if (packet.hasRotation()) {
250
            fullPacket = new ServerboundMovePlayerPacket.PosRot(
251
                    mc.player.getX(),
252
                    mc.player.getY(),
253
                    mc.player.getZ(),
254
                    packet.getYRot(0),
255
                    packet.getXRot(0),
256
                    packet.isOnGround(),
257
                    mc.player.horizontalCollision
258
            );
259
        } else {
260
            fullPacket = new ServerboundMovePlayerPacket.Pos(
261
                    mc.player.getX(),
262
                    mc.player.getY(),
263
                    mc.player.getZ(),
264
                    packet.isOnGround(),
265
                    mc.player.horizontalCollision
266
            );
267
        }
268
269
        antiKickPacket(fullPacket, mc.player.getY());
270
        return fullPacket;
271
    }
272
273
    public boolean onReceiveAbilities(ClientboundPlayerAbilitiesPacket packet) {
274
        if (packet == null) return false;
275
        if (mode.get() != Mode.ABILITIES) return false;
276
277
        Minecraft mc = Minecraft.getInstance();
278
        if (mc == null || mc.player == null) return false;
279
280
        mc.player.getAbilities().invulnerable = packet.isInvulnerable();
281
        mc.player.getAbilities().instabuild = packet.canInstabuild();
282
        mc.player.getAbilities().setWalkingSpeed(packet.getWalkingSpeed());
283
        return true;
284
    }
285
286
    public float getOffGroundSpeed() {
287
        Minecraft mc = Minecraft.getInstance();
288
        if (mc == null || mc.player == null) return -1;
289
        if (!isEnabled() || mode.get() != Mode.VELOCITY) return -1;
290
        return speed.get().floatValue() * (mc.player.isSprinting() ? 15f : 10f);
291
    }
292
293
    public boolean noSneak() {
294
        return isEnabled() && mode.get() == Mode.VELOCITY && noSneak.get();
295
    }
296
297
    private void tickMeteorMode(Minecraft mc) {
298
        float currentYaw = mc.player.getYRot();
299
        if (mc.player.fallDistance >= 3f && currentYaw == lastYaw && mc.player.getDeltaMovement().length() < 0.003d) {
300
            mc.player.setYRot(currentYaw + (flip ? 1 : -1));
301
            flip = !flip;
302
        }
303
        lastYaw = currentYaw;
304
305
        if (delayLeft > 0) delayLeft--;
306
307
        if (offLeft <= 0 && delayLeft <= 0) {
308
            delayLeft = delay.get();
309
            offLeft = offTime.get();
310
311
            if (antiKickMode.get() == AntiKickMode.PACKET) {
312
                if (mc.player instanceof LocalPlayerAccessor accessor) {
313
                    accessor.combatant$setTicksSinceLastPositionPacketSent(20);
314
                }
315
            }
316
        } else if (delayLeft <= 0) {
317
            boolean shouldReturn = false;
318
319
            if (antiKickMode.get() == AntiKickMode.NORMAL) {
320
                if (mode.get() == Mode.ABILITIES) {
321
                    abilitiesOff();
322
                    shouldReturn = true;
323
                }
324
            } else if (antiKickMode.get() == AntiKickMode.PACKET && offLeft == offTime.get()) {
325
                if (mc.player instanceof LocalPlayerAccessor accessor) {
326
                    accessor.combatant$setTicksSinceLastPositionPacketSent(20);
327
                }
328
            }
329
330
            offLeft--;
331
332
            if (shouldReturn) return;
333
        }
334
335
        if (mc.player.getYRot() != lastYaw) mc.player.setYRot(lastYaw);
336
337
        switch (mode.get()) {
338
            case VELOCITY -> {
339
                mc.player.getAbilities().flying = false;
340
                double horizontalSpeed = speed.get() * (mc.player.isSprinting() ? 15f : 10f);
341
                double[] dir = MovementUtil.forward(horizontalSpeed);
342
                Vec3 playerVelocity = new Vec3(dir[0], 0.0, dir[1]);
343
                if (mc.options.keyJump.isDown()) {
344
                    playerVelocity = playerVelocity.add(0, speed.get() * (verticalSpeedMatch.get() ? 10f : 5f), 0);
345
                }
346
                if (mc.options.keyShift.isDown()) {
347
                    playerVelocity = playerVelocity.subtract(0, speed.get() * (verticalSpeedMatch.get() ? 10f : 5f), 0);
348
                }
349
                mc.player.setDeltaMovement(playerVelocity);
350
                if (noSneak.get()) {
351
                    mc.player.setOnGround(false);
352
                }
353
            }
354
            case ABILITIES -> {
355
                if (mc.player.isSpectator()) return;
356
                mc.player.getAbilities().setFlyingSpeed(speed.get().floatValue());
357
                mc.player.getAbilities().flying = true;
358
                if (!mc.player.getAbilities().instabuild) {
359
                    mc.player.getAbilities().mayfly = true;
360
                }
361
            }
362
            default -> {
363
            }
364
        }
365
    }
366
367
    private void antiKickPacket(ServerboundMovePlayerPacket packet, double currentY) {
368
        Minecraft mc = Minecraft.getInstance();
369
        LocalPlayer player = mc != null ? mc.player : null;
370
        if (player == null) return;
371
372
        if (delayLeft <= 0 && lastPacketY != Double.MAX_VALUE
373
                && shouldFlyDown(currentY, lastPacketY) && isOnAir(player)) {
374
            ((ServerboundMovePlayerPacketAccessor) packet).combatant$setY(lastPacketY - 0.03130D);
375
        } else {
376
            lastPacketY = currentY;
377
        }
378
    }
379
380
    private boolean shouldFlyDown(double currentY, double lastY) {
381
        if (currentY >= lastY) {
382
            return true;
383
        }
384
        return lastY - currentY < 0.03130D;
385
    }
386
387
    private boolean isOnAir(LocalPlayer player) {
388
        return !player.onGround()
389
                && !player.isInWater()
390
                && !player.isInLava()
391
                && !player.onClimbable();
392
    }
393
394
    private void abilitiesOff() {
395
        Minecraft mc = Minecraft.getInstance();
396
        if (mc == null || mc.player == null) return;
397
        mc.player.getAbilities().flying = false;
398
        mc.player.getAbilities().setFlyingSpeed(0.05f);
399
        if (!mc.player.getAbilities().instabuild) {
400
            mc.player.getAbilities().mayfly = false;
401
        }
402
    }
403
404
    private void syncModeChange() {
405
        Mode current = mode.get();
406
        if (current == lastMode) return;
407
        lastMode = current;
408
        if (!isEnabled() || !canUpdate()) return;
409
        abilitiesOff();
410
        resetModeState();
411
    }
412
413
    private boolean canUpdate() {
414
        Minecraft mc = Minecraft.getInstance();
415
        return mc != null && mc.player != null && mc.level != null;
416
    }
417
418
    private boolean isMeteorMode() {
419
        return mode.get() == Mode.ABILITIES || mode.get() == Mode.VELOCITY;
420
    }
421
422
    private boolean supportsAntiKick() {
423
        return mode.get() == Mode.ABILITIES || mode.get() == Mode.VELOCITY;
424
    }
425
426
    private boolean usesSpeed() {
427
        return switch (mode.get()) {
428
            case ABILITIES, VELOCITY -> true;
429
            default -> false;
430
        };
431
    }
432
433
    private void resetModeState() {
434
        delayLeft = delay.get();
435
        offLeft = offTime.get();
436
        flip = false;
437
        lastPacketY = Double.MAX_VALUE;
438
        vulcanFlags = 0;
439
        vulcanWait = false;
440
        grimTicks = 0;
441
    }
442
443
    public enum Mode {
444
        ABILITIES,
445
        VELOCITY,
446
        AIRWALK,
447
        SPARTAN_524,
448
        VULCAN_277,
449
        VULCAN_286_113,
450
        VULCAN_286_18,
451
        GRIM_2859_V
452
    }
453
454
    public enum AntiKickMode {
455
        NORMAL,
456
        PACKET,
457
        NONE
458
    }
459
}
460
Goon ClientMovementsrc/main/java/com/pendonym/module/movement/Flight.javaJava · 32 lines · 1019 B
Flight.javaJava · Minecraft 26.2 · 32 lines · 1019 B · complete file, verbatim
1
package com.pendonym.module.movement;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.world.phys.Vec3;
5
import com.pendonym.module.Module;
6
7
@Module.Info(name = "key.module.goon.flight", category = "Movement")
8
public class Flight extends Module {
9
    public static final Flight INSTANCE = new Flight();
10
11
    int toggle = 0;
12
    double fallSpeed = -0.4;
13
14
    @Override
15
    public void onTick() {
16
        Minecraft client = Minecraft.getInstance();
17
        if (client.player == null) return;
18
19
        if (client.options.keyJump.isDown()) {
20
            Vec3 velocity = client.player.getDeltaMovement();
21
            Vec3 newVelocity = new Vec3(velocity.x, -fallSpeed, velocity.z);
22
23
            newVelocity = new Vec3(newVelocity.x, (toggle==0 && newVelocity.y>fallSpeed) ? fallSpeed : newVelocity.y, newVelocity.z);
24
            client.player.setDeltaMovement(newVelocity);
25
26
            if (toggle == 0 | newVelocity.y <= -0.04) {
27
                toggle = 40;
28
            }
29
            toggle--;
30
        }
31
    }
32
}