FastBreak module

FastBreak: Minecraft 26.3 cheat module, full source for every implementation (3 clients: OfflineClient, KiwiClient, LiquidBounce (Kotlin)).

3 implementationsPLAYERWORLD

Full module source: 3 implementations

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

OfflineClientPLAYERsrc/main/java/com/jellypudding/offlineclient/modules/player/FastBreak.javaJava · 291 lines · 12.2 KB

Breaks blocks faster and without the vanilla wait.

SettingsModeSpeedHaste levelInstamineGrim bypassBlocksList modeDelayChanceSafe first clickNo air penalty
FastBreak.javaJava · Minecraft 26.2 · 291 lines · 12.2 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.player;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.LeftClickEvent;
5
import com.jellypudding.offlineclient.event.events.PacketSendEvent;
6
import com.jellypudding.offlineclient.event.events.TickEvent;
7
import com.jellypudding.offlineclient.module.Category;
8
import com.jellypudding.offlineclient.module.Module;
9
import com.jellypudding.offlineclient.setting.BoolSetting;
10
import com.jellypudding.offlineclient.setting.EnumSetting;
11
import com.jellypudding.offlineclient.setting.NumberSetting;
12
import com.jellypudding.offlineclient.setting.RegistryListSetting;
13
import com.jellypudding.offlineclient.util.PacketUtil;
14
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
15
import net.minecraft.client.player.LocalPlayer;
16
import net.minecraft.core.BlockPos;
17
import net.minecraft.core.registries.BuiltInRegistries;
18
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
19
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
20
import net.minecraft.world.effect.MobEffectInstance;
21
import net.minecraft.world.effect.MobEffects;
22
import net.minecraft.world.level.block.Block;
23
import net.minecraft.world.level.block.state.BlockState;
24
import net.minecraft.world.phys.BlockHitResult;
25
26
import java.util.List;
27
import java.util.concurrent.ThreadLocalRandom;
28
29
public final class FastBreak extends Module {
30
31
    public enum Mode { NORMAL, HASTE, DAMAGE }
32
33
    public enum ListMode { WHITELIST, BLACKLIST }
34
35
    // The server finishes a block once the client reports this much progress.
36
    private static final float SERVER_ACCEPTS = 0.7f;
37
38
    // A block whose tick progress passes this is gone on the second server tick.
39
    private static final float INSTAMINE_PROGRESS = 0.5f;
40
41
    // The highest progress a tick may predict before the client breaks the
42
    // block on its own and drifts away from the server.
43
    private static final float SAFE_PROGRESS = 0.9f;
44
45
    private static final int VANILLA_DELAY = 5;
46
47
    private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
48
        "How the break is sped up.", Mode.NORMAL)
49
        .describe(Mode.NORMAL, "Multiplies the break speed the client predicts.")
50
        .describe(Mode.HASTE, "Gives you a Haste effect the server never sees.")
51
        .describe(Mode.DAMAGE, "Reports the block finished as soon as the server would accept it.");
52
    private final NumberSetting speed = new NumberSetting("Speed",
53
        "Speeds up the break the client predicts. The server keeps its own timer.",
54
        1, 1, 10, 0.1, "x").min(1).max(100).under(mode, Mode.NORMAL);
55
    private final NumberSetting hasteLevel = new NumberSetting("Haste level",
56
        "Level of the Haste effect. Above two is not recommended.", 2, 1, 5, 1, "")
57
        .min(1).max(10).under(mode, Mode.HASTE);
58
    private final BoolSetting instamine = new BoolSetting("Instamine",
59
        "Removes a block on the first click when the server will finish it within two ticks.",
60
        true).under(mode, Mode.DAMAGE);
61
    private final BoolSetting grimBypass = new BoolSetting("Grim bypass",
62
        "Sends an extra abort packet after every finish to slip past the Grim fast break check.",
63
        false).under(mode, Mode.DAMAGE);
64
    private final RegistryListSetting<Block> blocks = new RegistryListSetting<>("Blocks",
65
        "Blocks the speed up applies to. Click to pick them.", BuiltInRegistries.BLOCK, List.of())
66
        .under(mode, Mode.NORMAL, Mode.DAMAGE);
67
    private final EnumSetting<ListMode> listMode = new EnumSetting<>("List mode",
68
        "What the block list means.", ListMode.BLACKLIST)
69
        .describe(ListMode.WHITELIST, "Only the listed blocks are sped up.")
70
        .describe(ListMode.BLACKLIST, "Every block except the listed ones is sped up.")
71
        .under(mode, Mode.NORMAL, Mode.DAMAGE);
72
    private final NumberSetting delay = new NumberSetting("Delay",
73
        "Ticks between breaking blocks. Vanilla waits 5.", 0, 0, 5, 1, " ticks");
74
    private final NumberSetting chance = new NumberSetting("Chance",
75
        "Share of blocks that get sped up. Below a hundred the timing looks less mechanical.",
76
        100, 1, 100, 1, "%").min(1).max(100);
77
    private final BoolSetting safeFirstClick = new BoolSetting("Safe first click",
78
        "A single click on a block that breaks instantly does nothing. Hold to break it.", false);
79
    private final BoolSetting airPenalty = new BoolSetting("No air penalty",
80
        "Mine at full speed in the air. Vanilla mines five times slower off the ground.", true);
81
82
    // Ticks the vanilla wait is left alone after a guarded click.
83
    private int guardTicks;
84
85
    // True from a fresh press until the first block it lands on.
86
    private boolean freshClick;
87
88
    // The block the chance was last rolled for and how the roll went.
89
    private BlockPos rolledFor;
90
    private boolean rolled;
91
92
    public FastBreak() {
93
        super("FastBreak", "Breaks blocks faster and without the vanilla wait.", Category.PLAYER);
94
        addSettings(mode, speed, hasteLevel, instamine, grimBypass, blocks, listMode, delay,
95
            chance, safeFirstClick, airPenalty);
96
        searchTags("fast break", "speed mine", "instant mine", "nuker speed", "haste",
97
            "break delay", "instamine");
98
    }
99
100
    @Override
101
    public String getSuffix() {
102
        return switch (mode.getValue()) {
103
            case NORMAL -> speed.getValue() > 1 ? speed.getValueString() : null;
104
            case HASTE -> "haste " + hasteLevel.getInt();
105
            case DAMAGE -> "damage";
106
        };
107
    }
108
109
    @Override
110
    protected void onEnable() {
111
        guardTicks = 0;
112
        freshClick = false;
113
    }
114
115
    @Override
116
    protected void onDisable() {
117
        removeHaste();
118
    }
119
120
    // Called from the player mixin for every break speed the client predicts.
121
    public float adjustSpeed(BlockState state, float vanilla) {
122
        if (!isEnabled() || !inGame()) {
123
            return vanilla;
124
        }
125
        float adjusted = vanilla;
126
        // Vanilla divides purely on being off the ground. Water has its own factor.
127
        if (airPenalty.isOn() && !mc.player.onGround()) {
128
            adjusted *= 5;
129
        }
130
        if (!mode.is(Mode.NORMAL) || !allows(state.getBlock()) || !lucky(aimedBlock())) {
131
            return adjusted;
132
        }
133
        return capBelowInstant(state, adjusted, adjusted * speed.getFloat());
134
    }
135
136
    private static BlockPos aimedBlock() {
137
        return mc.hitResult instanceof BlockHitResult hit ? hit.getBlockPos() : null;
138
    }
139
140
    // One roll per block. The same block reads the same way for as long as it is aimed at.
141
    private boolean lucky(BlockPos pos) {
142
        if (chance.getInt() >= 100 || pos == null) {
143
            return true;
144
        }
145
        if (!pos.equals(rolledFor)) {
146
            rolledFor = pos.immutable();
147
            rolled = ThreadLocalRandom.current().nextInt(100) < chance.getInt();
148
        }
149
        return rolled;
150
    }
151
152
    // A multiplier that turns a slow block into an instant one on the client would
153
    // have it vanish and come back. The speed stops just short of that instead.
154
    private float capBelowInstant(BlockState state, float before, float after) {
155
        if (!(mc.hitResult instanceof BlockHitResult hit)) {
156
            return after;
157
        }
158
        BlockPos pos = hit.getBlockPos();
159
        if (mc.level.getBlockState(pos) != state) {
160
            return after;
161
        }
162
        float hardness = state.getDestroySpeed(mc.level, pos);
163
        if (hardness <= 0) {
164
            return after;
165
        }
166
        float divisor = hardness * (mc.player.hasCorrectToolForDrops(state) ? 30 : 100);
167
        boolean instantBefore = before / divisor >= 1;
168
        boolean instantAfter = after / divisor >= 1;
169
        return instantBefore == instantAfter ? after : SAFE_PROGRESS * divisor;
170
    }
171
172
    // Called from the game mode mixin with the progress one tick adds whilst mining.
173
    public float adjustProgress(BlockState state, float progress, float delta) {
174
        if (!isEnabled() || !mode.is(Mode.DAMAGE) || !allows(state.getBlock()) || !lucky(aimedBlock())) {
175
            return delta;
176
        }
177
        return progress + delta >= SERVER_ACCEPTS ? 1 : delta;
178
    }
179
180
    // True when a first click should remove the block outright with a start and
181
    // stop pair. Damage mode only.
182
    public boolean instamines(BlockState state, BlockPos pos) {
183
        if (!isEnabled() || !inGame() || !mode.is(Mode.DAMAGE) || !instamine.isOn()
184
            || mc.player.getAbilities().instabuild || !allows(state.getBlock()) || !lucky(pos)) {
185
            return false;
186
        }
187
        float delta = state.getDestroyProgress(mc.player, mc.level, pos);
188
        return delta > INSTAMINE_PROGRESS && delta < 1;
189
    }
190
191
    // True when a fresh click on an instantly breakable block should be swallowed.
192
    // The vanilla wait then runs before a held key breaks it.
193
    public boolean guardsClick(BlockState state, BlockPos pos) {
194
        if (!isEnabled() || !inGame() || !safeFirstClick.isOn() || !freshClick) {
195
            return false;
196
        }
197
        freshClick = false;
198
        if (mc.player.getAbilities().instabuild
199
            || state.getDestroyProgress(mc.player, mc.level, pos) < 1) {
200
            return false;
201
        }
202
        guardTicks = VANILLA_DELAY;
203
        mc.gameMode.destroyDelay = VANILLA_DELAY;
204
        return true;
205
    }
206
207
    private boolean allows(Block block) {
208
        return blocks.contains(block) == listMode.is(ListMode.WHITELIST);
209
    }
210
211
    @Subscribe
212
    private void onLeftClick(LeftClickEvent event) {
213
        freshClick = true;
214
    }
215
216
    @Subscribe
217
    private void onTick(TickEvent event) {
218
        if (!inGame() || mc.gameMode == null) {
219
            return;
220
        }
221
        if (mode.is(Mode.HASTE)) {
222
            addHaste();
223
        } else {
224
            removeHaste();
225
        }
226
        // A press is handled before this tick. An unused one is stale.
227
        freshClick = false;
228
        if (guardTicks > 0) {
229
            guardTicks--;
230
            return;
231
        }
232
        mc.gameMode.destroyDelay = Math.min(mc.gameMode.destroyDelay, delay.getInt());
233
    }
234
235
    // The effect is hidden. The status bar and the server side both stay as they were.
236
    private void addHaste() {
237
        int amplifier = hasteLevel.getInt() - 1;
238
        MobEffectInstance haste = mc.player.getEffect(MobEffects.HASTE);
239
        if (haste == null || haste.getAmplifier() < amplifier) {
240
            mc.player.addEffect(new MobEffectInstance(MobEffects.HASTE,
241
                MobEffectInstance.INFINITE_DURATION, amplifier, false, false, false));
242
        }
243
    }
244
245
    // A real Haste effect shows its icon and is left alone.
246
    private void removeHaste() {
247
        if (!inGame()) {
248
            return;
249
        }
250
        MobEffectInstance haste = mc.player.getEffect(MobEffects.HASTE);
251
        if (haste != null && !haste.showIcon()) {
252
            mc.player.removeEffect(MobEffects.HASTE);
253
        }
254
    }
255
256
    @Subscribe
257
    private void onPacketSend(PacketSendEvent event) {
258
        if (event.getPacket() instanceof ServerboundMovePlayerPacket packet) {
259
            claimGround(event, packet);
260
        } else if (event.getPacket() instanceof ServerboundPlayerActionPacket packet) {
261
            abortAbove(packet);
262
        }
263
    }
264
265
    // The server applies its own airborne mining penalty.
266
    private void claimGround(PacketSendEvent event, ServerboundMovePlayerPacket packet) {
267
        if (!airPenalty.isOn() || packet.isOnGround()) {
268
            return;
269
        }
270
        // The packet thread can drop the player and the game mode mid handler.
271
        LocalPlayer player = mc.player;
272
        MultiPlayerGameMode gameMode = mc.gameMode;
273
        if (player == null || gameMode == null || !gameMode.isDestroying()) {
274
            return;
275
        }
276
        event.setPacket(PacketUtil.withOnGround(packet, player, true));
277
    }
278
279
    // Grim skips its fast break check when an abort for another block follows a finish.
280
    private void abortAbove(ServerboundPlayerActionPacket packet) {
281
        LocalPlayer player = mc.player;
282
        if (!mode.is(Mode.DAMAGE) || !grimBypass.isOn() || player == null
283
            || packet.getAction() != ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK) {
284
            return;
285
        }
286
        player.connection.send(new ServerboundPlayerActionPacket(
287
            ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK,
288
            packet.getPos().above(), packet.getDirection()));
289
    }
290
}
291
KiwiClientPLAYERsrc/main/java/com/tangykiwi/kiwiclient/module/player/FastBreak.javaJava · 13 lines · 350 B

Break blocks instantly

FastBreak.javaJava · Minecraft 26.2 · 13 lines · 350 B · complete file, verbatimOriginal ↗
1
package com.tangykiwi.kiwiclient.module.player;
2
3
import com.tangykiwi.kiwiclient.module.Category;
4
import com.tangykiwi.kiwiclient.module.Module;
5
6
public class FastBreak extends Module{
7
    public FastBreak() {
8
        super("FastBreak", "Break blocks instantly", Category.PLAYER);
9
    }
10
11
    // handling done in ClientPlayerInteractionManagerMixin
12
}
13
LiquidBounce (Kotlin)WORLDsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/ModuleFastBreak.ktKotlin · 99 lines · 3.3 KB

Allows you to break blocks faster.

SettingsBreakDamageOnlyTool
ModuleFastBreak.ktKotlin · Minecraft 26.2 · 99 lines · 3.3 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.world
20
21
import net.ccbluex.liquidbounce.config.types.group.Mode
22
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
23
import net.ccbluex.liquidbounce.config.types.group.NoneMode
24
import net.ccbluex.liquidbounce.event.events.GameTickEvent
25
import net.ccbluex.liquidbounce.event.events.PacketEvent
26
import net.ccbluex.liquidbounce.event.handler
27
import net.ccbluex.liquidbounce.features.module.ClientModule
28
import net.ccbluex.liquidbounce.features.module.ModuleCategories
29
import net.ccbluex.liquidbounce.utils.item.isMiningTool
30
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket
31
32
/**
33
 * FastBreak module
34
 *
35
 * Allows you to break blocks faster.
36
 */
37
object ModuleFastBreak : ClientModule("FastBreak", ModuleCategories.WORLD) {
38
39
    private const val VANILLA_DESTROY_DELAY = 5
40
41
    private val breakDamage by float("BreakDamage", 0.8f, 0.1f..1f)
42
    private val onlyTool by boolean("OnlyTool", false)
43
44
    private val modeChoice = choices("Mode", 0) { arrayOf(NoneMode(it), AbortAnother) }.apply(::tagBy)
45
46
    val repeatable = handler<GameTickEvent> {
47
        if (onlyTool && !player.mainHandItem.isMiningTool) {
48
            return@handler
49
        }
50
51
        interaction.destroyDelay = 0
52
53
        if (interaction.destroyProgress > breakDamage) {
54
            interaction.destroyProgress = 1f
55
        }
56
    }
57
58
    override fun onDisabled() {
59
        interaction.destroyDelay = VANILLA_DESTROY_DELAY
60
        super.onDisabled()
61
    }
62
63
    /**
64
     * Bypass Grim 2.3.48 anti-cheat
65
     * Tested on eu.loyisa.cn
66
     *
67
     * https://github.com/GrimAnticheat/Grim/issues/1296
68
     */
69
    object AbortAnother : Mode("AbortAnother") {
70
71
        override val parent: ModeValueGroup<Mode>
72
            get() = modeChoice
73
74
        val packetHandler = handler<PacketEvent> {
75
            if (onlyTool && !player.mainHandItem.isMiningTool) {
76
                return@handler
77
            }
78
79
            val packet = it.packet
80
81
            if (packet is ServerboundPlayerActionPacket &&
82
                packet.action == ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK
83
            ) {
84
                val blockPos = packet.pos
85
86
                // Abort block break on the block above (which we are not breaking)
87
                network.send(
88
                    ServerboundPlayerActionPacket(
89
                        ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK,
90
                        blockPos.above(), packet.direction
91
                    )
92
                )
93
            }
94
        }
95
96
    }
97
98
}
99