BoatFly module

BoatFly: Minecraft 26.3 cheat module, full source for every implementation (2 clients: MelaHack (ThunderHack fork), Goon Client).

2 implementationsMOVEMENTMovement

Full module source: 2 implementations

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

MelaHack (ThunderHack fork)MOVEMENTsrc/main/java/thunder/hack/features/modules/movement/BoatFly.javaJava · 277 lines · 11.8 KB

Allows you to fly on boats.

SettingsModePhaseGravityAutoMountAllowShiftSpeedYSpeedAdvancedGlideSpeedClickSlotLimitOnGroundPacketSpoofPacketsJitterCancelRotationsCancelPauseEnableTicksWaitTicksStopUnloadedTimerHideBoat
BoatFly.javaJava · Minecraft 26.2 · 277 lines · 11.8 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.movement;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.network.protocol.common.ClientboundDisconnectPacket;
6
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
7
import net.minecraft.network.protocol.game.ClientboundMoveVehiclePacket;
8
import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket;
9
import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
10
import net.minecraft.network.protocol.game.ServerboundInteractPacket;
11
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
12
import net.minecraft.network.protocol.game.ServerboundMoveVehiclePacket;
13
import net.minecraft.network.protocol.game.ServerboundPlayerInputPacket;
14
import net.minecraft.world.InteractionHand;
15
import net.minecraft.world.entity.Entity;
16
import net.minecraft.world.entity.EntityType;
17
import net.minecraft.world.entity.EntityTypes;
18
import net.minecraft.world.entity.vehicle.boat.Boat;
19
import net.minecraft.world.inventory.ContainerInput;
20
import net.minecraft.world.item.Items;
21
import net.minecraft.world.level.block.Blocks;
22
import net.minecraft.world.phys.Vec3;
23
import org.jetbrains.annotations.NotNull;
24
import thunder.hack.ThunderHack;
25
import thunder.hack.events.impl.EventPlayerTravel;
26
import thunder.hack.events.impl.PacketEvent;
27
import thunder.hack.features.modules.Module;
28
import thunder.hack.setting.Setting;
29
import thunder.hack.setting.impl.SettingGroup;
30
import thunder.hack.utility.player.MovementUtility;
31
32
import java.util.ArrayList;
33
34
public class BoatFly extends Module {
35
    public BoatFly() {
36
        super("BoatFly", Category.MOVEMENT);
37
    }
38
39
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.Packet);
40
41
    private final Setting<Boolean> phase = new Setting<>("Phase", false);
42
    private final Setting<Boolean> gravity = new Setting<>("Gravity", false);
43
    private final Setting<Boolean> automount = new Setting<>("AutoMount", true);
44
    public final Setting<Boolean> allowShift = new Setting<>("AllowShift", true);
45
    private final Setting<Float> speed = new Setting<>("Speed", 2f, 0.0f, 25f);
46
    private final Setting<Float> yspeed = new Setting<>("YSpeed", 1f, 0.0f, 10f);
47
48
    // For pro players
49
    public final Setting<SettingGroup> advanced = new Setting<>("Advanced", new SettingGroup(false, 0));
50
    private final Setting<Float> glidespeed = new Setting<>("GlideSpeed", 0f, 0f, 10f).addToGroup(advanced);
51
    private final Setting<Boolean> slotClick = new Setting<>("ClickSlot", false).addToGroup(advanced);
52
    private final Setting<Boolean> limit = new Setting<>("Limit", true).addToGroup(advanced);
53
    private final Setting<Boolean> ongroundpacket = new Setting<>("OnGroundPacket", false).addToGroup(advanced);
54
    private final Setting<Boolean> spoofpackets = new Setting<>("SpoofPackets", false).addToGroup(advanced);
55
    private final Setting<Float> jitter = new Setting<>("Jitter", 0.1f, 0.0f, 10f, v -> spoofpackets.getValue()).addToGroup(advanced);
56
    private final Setting<Boolean> cancelrotations = new Setting<>("CancelRotations", true).addToGroup(advanced);
57
    private final Setting<Boolean> cancel = new Setting<>("Cancel", true).addToGroup(advanced);
58
    private final Setting<Boolean> pause = new Setting<>("Pause", false).addToGroup(advanced);
59
    private final Setting<Integer> enableticks = new Setting<>("EnableTicks", 10, 1, 100, v -> pause.getValue()).addToGroup(advanced);
60
    private final Setting<Integer> waitTicks = new Setting<>("WaitTicks", 10, 1, 100, v -> pause.getValue()).addToGroup(advanced);
61
    private final Setting<Boolean> stopunloaded = new Setting<>("StopUnloaded", true).addToGroup(advanced);
62
    private final Setting<Float> timer = new Setting<>("Timer", 1f, 0.1f, 5f).addToGroup(advanced);
63
    public final Setting<Boolean> hideBoat = new Setting<>("HideBoat", true).addToGroup(advanced);
64
65
    private final ArrayList<ServerboundMoveVehiclePacket> vehiclePackets = new ArrayList<>();
66
    private int ticksEnabled = 0;
67
    private int enableDelay = 0;
68
    private boolean waitedCooldown = false;
69
    private boolean returnGravity = false;
70
    private boolean jitterSwitch = false;
71
72
    @Override
73
    public void onEnable() {
74
        if (fullNullCheck()) {
75
            disable();
76
            return;
77
        }
78
79
        if (automount.getValue()) mountToBoat();
80
    }
81
82
    @Override
83
    public void onDisable() {
84
        ThunderHack.TICK_TIMER = 1.0f;
85
        vehiclePackets.clear();
86
        waitedCooldown = false;
87
88
        if (mc.player == null) return;
89
90
        if ((phase.getValue()) && mode.getValue() == Mode.Motion) {
91
            if (mc.player.getControlledVehicle() != null) mc.player.getControlledVehicle().noPhysics = false;
92
            mc.player.noPhysics = false;
93
        }
94
        if (mc.player.getControlledVehicle() != null) mc.player.getControlledVehicle().setNoGravity(false);
95
        mc.player.setNoGravity(false);
96
    }
97
98
99
    private float randomizeYOffset() {
100
        jitterSwitch = !jitterSwitch;
101
        return jitterSwitch ? jitter.getValue() : -jitter.getValue();
102
    }
103
104
    private void sendMovePacket(ServerboundMoveVehiclePacket pac) {
105
        vehiclePackets.add(pac);
106
        sendPacket(pac);
107
    }
108
109
    private void teleportToGround(Entity boat) {
110
        BlockPos blockPos = BlockPos.containing(boat.position());
111
        for (int i = 0; i < 255; ++i) {
112
            if (!mc.level.getBlockState(blockPos).canBeReplaced() || mc.level.getBlockState(blockPos).getBlock() == Blocks.WATER) {
113
                boat.setPos(boat.getX(), blockPos.getY() + 1, boat.getZ());
114
                sendMovePacket(ServerboundMoveVehiclePacket.fromEntity(boat));
115
                boat.setPos(boat.getX(), boat.getY(), boat.getZ());
116
                break;
117
            }
118
            blockPos = blockPos.below();
119
        }
120
    }
121
122
    private void mountToBoat() {
123
        for (Entity entity : mc.level.entitiesForRendering()) {
124
            if (!(entity instanceof Boat) || mc.player.distanceToSqr(entity) > 25.0f) continue;
125
            sendPacket(new ServerboundInteractPacket(entity.getId(), InteractionHand.MAIN_HAND, null, false));
126
            break;
127
        }
128
    }
129
130
    @EventHandler
131
    public void onPlayerTravel(@NotNull EventPlayerTravel ev) {
132
        if (!ev.isPre()) return;
133
        if (fullNullCheck()) return;
134
135
136
        if (mc.player.getControlledVehicle() == null) {
137
            if (automount.getValue())
138
                mountToBoat();
139
            return;
140
        }
141
142
        if (phase.getValue() && mode.getValue() == Mode.Motion) {
143
            mc.player.getControlledVehicle().noPhysics = true;
144
            mc.player.getControlledVehicle().setNoGravity(true);
145
            mc.player.noPhysics = true;
146
        }
147
148
        if (!returnGravity) {
149
            mc.player.getControlledVehicle().setNoGravity(!gravity.getValue());
150
            mc.player.setNoGravity(!gravity.getValue());
151
        }
152
153
        if (pause.getValue()) {
154
            if (ticksEnabled > enableticks.getValue() && !waitedCooldown) {
155
                ticksEnabled = 0;
156
                waitedCooldown = true;
157
                enableDelay = waitTicks.getValue();
158
            }
159
160
            if (enableDelay > 0 && waitedCooldown) {
161
                --enableDelay;
162
                return;
163
            }
164
165
            if (enableDelay <= 0) waitedCooldown = false;
166
        }
167
168
        Entity entity = mc.player.getControlledVehicle();
169
170
171
        if ((!mc.level.hasChunk((int) entity.position().x >> 4, (int) entity.position().z >> 4) || entity.position().y < -60) && stopunloaded.getValue()) {
172
            returnGravity = true;
173
            return;
174
        }
175
176
        if (timer.getValue() != 1.0f) ThunderHack.TICK_TIMER = (timer.getValue());
177
178
        entity.setYRot(mc.player.getYRot());
179
180
        double[] boatMotion = MovementUtility.forward(speed.getValue());
181
        double predictedX = entity.getX() + boatMotion[0];
182
        double predictedZ = entity.getZ() + boatMotion[1];
183
        double predictedY = entity.getY();
184
185
        if ((!mc.level.hasChunk((int) predictedX >> 4, (int) predictedZ >> 4) || entity.position().y < -60) && stopunloaded.getValue()) {
186
            returnGravity = true;
187
            return;
188
        }
189
190
        returnGravity = false;
191
192
        entity.setDeltaMovement(entity.getDeltaMovement().x(), -glidespeed.getValue() / 100.0f, entity.getDeltaMovement().z());
193
194
        if (mode.getValue() == Mode.Motion)
195
            entity.setDeltaMovement(boatMotion[0], entity.getDeltaMovement().y(), boatMotion[1]);
196
197
        if (mc.options.keyJump.isDown()) {
198
            if (mode.getValue() == Mode.Motion)
199
                entity.setDeltaMovement(entity.getDeltaMovement().x(), entity.getDeltaMovement().y() + yspeed.getValue(), entity.getDeltaMovement().z());
200
            else predictedY += yspeed.getValue();
201
        } else if (mc.options.keyShift.isDown()) {
202
            if (mode.getValue() == Mode.Motion)
203
                entity.setDeltaMovement(entity.getDeltaMovement().x(), entity.getDeltaMovement().y() - yspeed.getValue(), entity.getDeltaMovement().z());
204
            else predictedY -= yspeed.getValue();
205
        }
206
207
        if (!MovementUtility.isMoving()) entity.setDeltaMovement(0, entity.getDeltaMovement().y(), 0);
208
209
        if (ongroundpacket.getValue()) teleportToGround(entity);
210
211
        if (mode.getValue() == Mode.Packet) {
212
            entity.setPos(predictedX, predictedY, predictedZ);
213
            sendMovePacket(ServerboundMoveVehiclePacket.fromEntity(entity));
214
        }
215
216
        if (slotClick.getValue())
217
            mc.gameMode.handleContainerInput(mc.player.containerMenu.containerId, 0, 0, ContainerInput.CLONE, mc.player);
218
219
        if (spoofpackets.getValue()) {
220
            Vec3 vec3d = entity.position().add(0.0, randomizeYOffset(), 0.0);
221
            Boat entityBoat = new Boat(EntityTypes.OAK_BOAT, mc.level, () -> Items.OAK_BOAT);
222
            entityBoat.setPos(vec3d);
223
            entityBoat.setYRot(entity.getYRot());
224
            entityBoat.setXRot(entity.getXRot());
225
            sendMovePacket(ServerboundMoveVehiclePacket.fromEntity(entityBoat));
226
        }
227
228
        ev.cancel();
229
        ++ticksEnabled;
230
    }
231
232
    @EventHandler
233
    public void onPacketReceive(PacketEvent.Receive event) {
234
        if (fullNullCheck()) return;
235
236
        if (event.getPacket() instanceof ClientboundDisconnectPacket) disable();
237
238
        if (!mc.player.isHandsBusy() || returnGravity || waitedCooldown) return;
239
240
        if (cancel.getValue()) {
241
            if (event.getPacket() instanceof ClientboundMoveVehiclePacket) event.cancel();
242
            if (event.getPacket() instanceof ClientboundPlayerPositionPacket) event.cancel();
243
            if (event.getPacket() instanceof ClientboundMoveEntityPacket) event.cancel();
244
            if (event.getPacket() instanceof ClientboundSetEntityLinkPacket) event.cancel();
245
        }
246
    }
247
248
    @EventHandler
249
    public void onPacketSend(PacketEvent.Send event) {
250
        if (fullNullCheck()) return;
251
252
        if ((event.getPacket() instanceof ServerboundMovePlayerPacket.Rot && (cancelrotations.getValue()) || event.getPacket() instanceof ServerboundPlayerInputPacket) && mc.player.isHandsBusy())
253
            event.cancel();
254
255
        if (returnGravity && event.getPacket() instanceof ServerboundMoveVehiclePacket) event.cancel();
256
257
        if (event.getPacket() instanceof ServerboundPlayerInputPacket && allowShift.getValue()) {
258
            event.cancel();
259
        }
260
261
        if (mc.player.getControlledVehicle() == null || returnGravity || waitedCooldown)
262
            return;
263
264
        Vec3 boatPos = mc.player.getControlledVehicle().position();
265
        if ((!mc.level.hasChunk((int) boatPos.x() >> 4, (int) boatPos.z() >> 4) || boatPos.y() < -60) && stopunloaded.getValue())
266
            return;
267
268
        if (event.getPacket() instanceof ServerboundMoveVehiclePacket pac && limit.getValue() && mode.getValue() == Mode.Packet)
269
            if (vehiclePackets.contains(pac)) vehiclePackets.remove(pac);
270
            else event.cancel();
271
    }
272
273
    public enum Mode {
274
        Packet, Motion
275
    }
276
}
277
Goon ClientMovementsrc/main/java/com/pendonym/module/movement/BoatFly.javaJava · 35 lines · 1.1 KB
BoatFly.javaJava · Minecraft 26.2 · 35 lines · 1.1 KB · complete file, verbatim
1
package com.pendonym.module.movement;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.world.entity.Entity;
5
import net.minecraft.world.phys.Vec3;
6
import com.pendonym.module.Module;
7
8
@Module.Info(name = "key.module.goon.boat_fly", category = "Movement")
9
public class BoatFly extends Module {
10
    public static final BoatFly INSTANCE = new BoatFly();
11
12
    int toggle = 0;
13
    double fallSpeed = -0.4;
14
15
    @Override
16
    public void onTick() {
17
        Minecraft client = Minecraft.getInstance();
18
        if (client.player == null) return;
19
        Entity vehicle = client.player.getVehicle();
20
        if (vehicle == null) return;
21
22
        if (client.options.keyJump.isDown()) {
23
            Vec3 velocity = vehicle.getDeltaMovement();
24
            Vec3 newVelocity = new Vec3(velocity.x, -fallSpeed, velocity.z);
25
26
            newVelocity = new Vec3(newVelocity.x, (toggle==0 && newVelocity.y>fallSpeed) ? fallSpeed : newVelocity.y, newVelocity.z);
27
            vehicle.setDeltaMovement(newVelocity);
28
29
            if (toggle == 0 | newVelocity.y <= -0.04) {
30
                toggle = 40;
31
            }
32
            toggle--;
33
        }
34
    }
35
}