no-fall module

no-fall: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

1 implementationMovement

Clients with this module

Full module source: 1 implementation

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/NoFall.javaJava · 268 lines · 10.4 KB

Attempts to prevent you from taking fall damage.

Settingsmodeplaced-itemair-place-modeanchoranti-bouncepause-on-mace
NoFall.javaJava · Minecraft 26.2 · 268 lines · 10.4 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 it.unimi.dsi.fastutil.floats.FloatPredicate;
9
import meteordevelopment.meteorclient.events.packets.PacketEvent;
10
import meteordevelopment.meteorclient.events.world.TickEvent;
11
import meteordevelopment.meteorclient.mixin.ServerboundMovePlayerPacketAccessor;
12
import meteordevelopment.meteorclient.mixininterface.IServerboundMovePlayerPacket;
13
import meteordevelopment.meteorclient.mixininterface.IVec3;
14
import meteordevelopment.meteorclient.pathing.PathManagers;
15
import meteordevelopment.meteorclient.settings.BoolSetting;
16
import meteordevelopment.meteorclient.settings.EnumSetting;
17
import meteordevelopment.meteorclient.settings.Setting;
18
import meteordevelopment.meteorclient.settings.SettingGroup;
19
import meteordevelopment.meteorclient.systems.modules.Categories;
20
import meteordevelopment.meteorclient.systems.modules.Module;
21
import meteordevelopment.meteorclient.systems.modules.Modules;
22
import meteordevelopment.meteorclient.utils.Utils;
23
import meteordevelopment.meteorclient.utils.entity.EntityUtils;
24
import meteordevelopment.meteorclient.utils.player.FindItemResult;
25
import meteordevelopment.meteorclient.utils.player.InvUtils;
26
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
27
import meteordevelopment.meteorclient.utils.player.Rotations;
28
import meteordevelopment.meteorclient.utils.world.BlockUtils;
29
import meteordevelopment.orbit.EventHandler;
30
import net.minecraft.core.BlockPos;
31
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
32
import net.minecraft.world.InteractionHand;
33
import net.minecraft.world.attribute.EnvironmentAttributes;
34
import net.minecraft.world.item.BlockItem;
35
import net.minecraft.world.item.Item;
36
import net.minecraft.world.item.Items;
37
import net.minecraft.world.item.MaceItem;
38
import net.minecraft.world.level.ClipContext;
39
import net.minecraft.world.level.block.Block;
40
import net.minecraft.world.level.block.Blocks;
41
import net.minecraft.world.phys.BlockHitResult;
42
import net.minecraft.world.phys.HitResult;
43
44
public class NoFall extends Module {
45
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
46
47
    private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
48
        .name("mode")
49
        .description("The way you are saved from fall damage.")
50
        .defaultValue(Mode.Packet)
51
        .build()
52
    );
53
54
    private final Setting<PlacedItem> placedItem = sgGeneral.add(new EnumSetting.Builder<PlacedItem>()
55
        .name("placed-item")
56
        .description("Which block to place.")
57
        .defaultValue(PlacedItem.Bucket)
58
        .visible(() -> mode.get() == Mode.Place)
59
        .build()
60
    );
61
62
    private final Setting<PlaceMode> airPlaceMode = sgGeneral.add(new EnumSetting.Builder<PlaceMode>()
63
        .name("air-place-mode")
64
        .description("Whether place mode places before you die or before you take damage.")
65
        .defaultValue(PlaceMode.BeforeDeath)
66
        .visible(() -> mode.get() == Mode.AirPlace)
67
        .build()
68
    );
69
70
    private final Setting<Boolean> anchor = sgGeneral.add(new BoolSetting.Builder()
71
        .name("anchor")
72
        .description("Centers the player and reduces movement when using bucket or air place mode.")
73
        .defaultValue(true)
74
        .visible(() -> mode.get() != Mode.Packet)
75
        .build()
76
    );
77
78
    private final Setting<Boolean> antiBounce = sgGeneral.add(new BoolSetting.Builder()
79
        .name("anti-bounce")
80
        .description("Disables bouncing on slime-block and bed upon landing.")
81
        .defaultValue(true)
82
        .build()
83
    );
84
85
    private final Setting<Boolean> pauseOnMace = sgGeneral.add(new BoolSetting.Builder()
86
        .name("pause-on-mace")
87
        .description("Pauses NoFall when using a mace.")
88
        .defaultValue(true)
89
        .build()
90
    );
91
92
    private boolean placedWater;
93
    private BlockPos targetPos;
94
    private int timer;
95
    private boolean prePathManagerNoFall;
96
97
    public NoFall() {
98
        super(Categories.Movement, "no-fall", "Attempts to prevent you from taking fall damage.");
99
    }
100
101
    @Override
102
    public void onActivate() {
103
        prePathManagerNoFall = PathManagers.get().getSettings().getNoFall().get();
104
        if (mode.get() == Mode.Packet) PathManagers.get().getSettings().getNoFall().set(true);
105
106
        placedWater = false;
107
    }
108
109
    @Override
110
    public void onDeactivate() {
111
        PathManagers.get().getSettings().getNoFall().set(prePathManagerNoFall);
112
    }
113
114
    @EventHandler
115
    private void onSendPacket(PacketEvent.Send event) {
116
        if (mc.player == null) return;
117
        if (pauseOnMace.get() && mc.player.getMainHandItem().getItem() instanceof MaceItem) return;
118
        if (mc.player.getAbilities().instabuild
119
            || !(event.packet instanceof ServerboundMovePlayerPacket)
120
            || mode.get() != Mode.Packet
121
            || ((IServerboundMovePlayerPacket) event.packet).meteor$getTag() == 1337) return;
122
123
124
        if (!Modules.get().isActive(Flight.class)) {
125
            if (mc.player.isFallFlying()) return;
126
            if (mc.player.getDeltaMovement().y > -0.5) return;
127
            ((ServerboundMovePlayerPacketAccessor) event.packet).meteor$setOnGround(true);
128
        } else {
129
            ((ServerboundMovePlayerPacketAccessor) event.packet).meteor$setOnGround(true);
130
        }
131
    }
132
133
    @EventHandler
134
    private void onTick(TickEvent.Pre event) {
135
        if (!Utils.canUpdate()) return;
136
137
        if (timer > 20) {
138
            placedWater = false;
139
            timer = 0;
140
        }
141
142
        if (mc.player.getAbilities().instabuild) return;
143
        if (pauseOnMace.get() && mc.player.getMainHandItem().getItem() instanceof MaceItem) return;
144
145
        // Airplace mode
146
        if (mode.get() == Mode.AirPlace) {
147
            // Test if fall damage setting is valid
148
            if (!airPlaceMode.get().test((float) mc.player.fallDistance)) return;
149
150
            // Center and place block
151
            if (anchor.get()) PlayerUtils.centerPlayer();
152
153
            Rotations.rotate(mc.player.getYRot(), 90, Integer.MAX_VALUE, () -> {
154
                double preY = mc.player.getDeltaMovement().y;
155
                ((IVec3) mc.player.getDeltaMovement()).meteor$setY(0);
156
157
                BlockUtils.place(mc.player.blockPosition().below(), InvUtils.findInHotbar(itemStack -> itemStack.getItem() instanceof BlockItem), false, 0, true);
158
159
                ((IVec3) mc.player.getDeltaMovement()).meteor$setY(preY);
160
            });
161
        }
162
163
        // Bucket mode
164
        else if (mode.get() == Mode.Place) {
165
            PlacedItem placedItem1 = mc.level.environmentAttributes().getDimensionValue(EnvironmentAttributes.WATER_EVAPORATES) && placedItem.get() == PlacedItem.Bucket ? PlacedItem.PowderSnow : placedItem.get();
166
            if (mc.player.fallDistance > 3 && !EntityUtils.isAboveWater(mc.player)) {
167
                Item item = placedItem1.item;
168
169
                // Place
170
                FindItemResult findItemResult = InvUtils.findInHotbar(item);
171
                if (!findItemResult.found()) return;
172
173
                // Center player
174
                if (anchor.get()) PlayerUtils.centerPlayer();
175
176
                // Check if there is a block within 5 blocks
177
                BlockHitResult result = mc.level.clip(new ClipContext(mc.player.position(), mc.player.position().subtract(0, 5, 0), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, mc.player));
178
179
                // Place
180
                if (result != null && result.getType() == HitResult.Type.BLOCK) {
181
                    targetPos = result.getBlockPos().above();
182
                    if (placedItem1 == PlacedItem.Bucket)
183
                        useItem(findItemResult, true, targetPos, true);
184
                    else {
185
                        useItem(findItemResult, placedItem1 == PlacedItem.PowderSnow, targetPos, false);
186
                    }
187
                }
188
            }
189
190
            // Remove placed
191
            if (placedWater) {
192
                timer++;
193
                if (mc.player.getInBlockState().getBlock() == placedItem1.block) {
194
                    useItem(InvUtils.findInHotbar(Items.BUCKET), false, targetPos, true);
195
                } else if (mc.level.getBlockState(mc.player.blockPosition().below()).getBlock() == Blocks.POWDER_SNOW && mc.player.fallDistance == 0 && placedItem1.block == Blocks.POWDER_SNOW) { //check if the powder snow block is still there and the player is on the ground
196
                    useItem(InvUtils.findInHotbar(Items.BUCKET), false, targetPos.below(), true);
197
                }
198
            }
199
        }
200
    }
201
202
    public boolean cancelBounce() {
203
        return isActive() && antiBounce.get();
204
    }
205
206
    private void useItem(FindItemResult item, boolean placedWater, BlockPos blockPos, boolean useItem) {
207
        if (!item.found()) return;
208
209
        if (useItem) {
210
            Rotations.rotate(Rotations.getYaw(blockPos), Rotations.getPitch(blockPos), 10, true, () -> {
211
                if (item.isOffhand()) {
212
                    mc.gameMode.useItem(mc.player, InteractionHand.OFF_HAND);
213
                } else {
214
                    InvUtils.swap(item.slot(), true);
215
                    mc.gameMode.useItem(mc.player, InteractionHand.MAIN_HAND);
216
                    InvUtils.swapBack();
217
                }
218
            });
219
        } else {
220
            BlockUtils.place(blockPos, item, true, 10, true);
221
        }
222
223
        this.placedWater = placedWater;
224
    }
225
226
    @Override
227
    public String getInfoString() {
228
        return mode.get().toString();
229
    }
230
231
    public enum Mode {
232
        Packet,
233
        AirPlace,
234
        Place
235
    }
236
237
    public enum PlacedItem {
238
        Bucket(Items.WATER_BUCKET, Blocks.WATER),
239
        PowderSnow(Items.POWDER_SNOW_BUCKET, Blocks.POWDER_SNOW),
240
        HayBale(Items.HAY_BLOCK, Blocks.HAY_BLOCK),
241
        Cobweb(Items.COBWEB, Blocks.COBWEB),
242
        SlimeBlock(Items.SLIME_BLOCK, Blocks.SLIME_BLOCK);
243
244
        private final Item item;
245
        private final Block block;
246
247
        PlacedItem(Item item, Block block) {
248
            this.item = item;
249
            this.block = block;
250
        }
251
    }
252
253
    public enum PlaceMode {
254
        BeforeDamage(height -> height > 2),
255
        BeforeDeath(height -> height > Math.max(PlayerUtils.getTotalHealth(), 2));
256
257
        private final FloatPredicate fallHeight;
258
259
        PlaceMode(FloatPredicate fallHeight) {
260
            this.fallHeight = fallHeight;
261
        }
262
263
        public boolean test(float fallHeight) {
264
            return this.fallHeight.test(fallHeight);
265
        }
266
    }
267
}
268