instant-rebreak module

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

1 implementationPlayer

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 ClientPlayersrc/main/java/meteordevelopment/meteorclient/systems/modules/player/InstantRebreak.javaJava · 139 lines · 4.9 KB

Instantly re-breaks blocks in the same position.

Settingsdelayonly-pickrotaterendershape-modeside-colorline-color
InstantRebreak.javaJava · Minecraft 26.2 · 139 lines · 4.9 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.player;
7
8
import meteordevelopment.meteorclient.events.entity.player.StartBreakingBlockEvent;
9
import meteordevelopment.meteorclient.events.render.Render3DEvent;
10
import meteordevelopment.meteorclient.events.world.TickEvent;
11
import meteordevelopment.meteorclient.renderer.ShapeMode;
12
import meteordevelopment.meteorclient.settings.*;
13
import meteordevelopment.meteorclient.systems.modules.Categories;
14
import meteordevelopment.meteorclient.systems.modules.Module;
15
import meteordevelopment.meteorclient.utils.player.Rotations;
16
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
17
import meteordevelopment.meteorclient.utils.world.BlockUtils;
18
import meteordevelopment.orbit.EventHandler;
19
import net.minecraft.core.BlockPos;
20
import net.minecraft.core.Direction;
21
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
22
import net.minecraft.network.protocol.game.ServerboundSwingPacket;
23
import net.minecraft.tags.ItemTags;
24
import net.minecraft.world.InteractionHand;
25
26
public class InstantRebreak extends Module {
27
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
28
    private final SettingGroup sgRender = settings.createGroup("Render");
29
30
    private final Setting<Integer> tickDelay = sgGeneral.add(new IntSetting.Builder()
31
        .name("delay")
32
        .description("The delay between break attempts.")
33
        .defaultValue(0)
34
        .min(0)
35
        .sliderMax(20)
36
        .build()
37
    );
38
39
    private final Setting<Boolean> pick = sgGeneral.add(new BoolSetting.Builder()
40
        .name("only-pick")
41
        .description("Only tries to mine the block if you are holding a pickaxe.")
42
        .defaultValue(true)
43
        .build()
44
    );
45
46
    private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
47
        .name("rotate")
48
        .description("Faces the block being mined server side.")
49
        .defaultValue(true)
50
        .build()
51
    );
52
53
    // Render
54
55
    private final Setting<Boolean> render = sgRender.add(new BoolSetting.Builder()
56
        .name("render")
57
        .description("Renders an overlay on the block being broken.")
58
        .defaultValue(true)
59
        .build()
60
    );
61
62
    private final Setting<ShapeMode> shapeMode = sgRender.add(new EnumSetting.Builder<ShapeMode>()
63
        .name("shape-mode")
64
        .description("How the shapes are rendered.")
65
        .defaultValue(ShapeMode.Both)
66
        .build()
67
    );
68
69
    private final Setting<SettingColor> sideColor = sgRender.add(new ColorSetting.Builder()
70
        .name("side-color")
71
        .description("The color of the sides of the blocks being rendered.")
72
        .defaultValue(new SettingColor(204, 0, 0, 10))
73
        .build()
74
    );
75
76
    private final Setting<SettingColor> lineColor = sgRender.add(new ColorSetting.Builder()
77
        .name("line-color")
78
        .description("The color of the lines of the blocks being rendered.")
79
        .defaultValue(new SettingColor(204, 0, 0, 255))
80
        .build()
81
    );
82
83
    public final BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(0, Integer.MIN_VALUE, 0);
84
    private int ticks;
85
    private Direction direction;
86
87
    public InstantRebreak() {
88
        super(Categories.Player, "instant-rebreak", "Instantly re-breaks blocks in the same position.");
89
    }
90
91
    @Override
92
    public void onActivate() {
93
        ticks = 0;
94
        blockPos.set(0, -1, 0);
95
    }
96
97
    @EventHandler
98
    private void onStartBreakingBlock(StartBreakingBlockEvent event) {
99
        direction = event.direction;
100
        blockPos.set(event.blockPos);
101
    }
102
103
    @EventHandler
104
    private void onTick(TickEvent.Pre event) {
105
        if (ticks >= tickDelay.get()) {
106
            ticks = 0;
107
108
            if (shouldMine()) {
109
                if (rotate.get())
110
                    Rotations.rotate(Rotations.getYaw(blockPos), Rotations.getPitch(blockPos), this::sendPacket);
111
                else sendPacket();
112
113
                mc.getConnection().send(new ServerboundSwingPacket(InteractionHand.MAIN_HAND));
114
            }
115
        } else {
116
            ticks++;
117
        }
118
    }
119
120
    public void sendPacket() {
121
        mc.gameMode.startPrediction(mc.level, sequence ->
122
            new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, blockPos, direction == null ? Direction.UP : direction, sequence)
123
        );
124
    }
125
126
    public boolean shouldMine() {
127
        if (mc.level.isOutsideBuildHeight(blockPos) || !BlockUtils.canBreak(blockPos)) return false;
128
129
        return !pick.get() || mc.player.getMainHandItem().is(ItemTags.PICKAXES);
130
    }
131
132
    @EventHandler
133
    private void onRender(Render3DEvent event) {
134
        if (!render.get() || !shouldMine()) return;
135
136
        event.renderer.box(blockPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0);
137
    }
138
}
139