Kaboom module

Kaboom: Minecraft 26.3 cheat module, full source for every implementation (1 client: OfflineClient).

1 implementationWORLD

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.

OfflineClientWORLDsrc/main/java/com/jellypudding/offlineclient/modules/world/Kaboom.javaJava · 135 lines · 4.5 KB

Blows a hole around you in one go.

SettingsPowerPackets a tickSoundParticles
Kaboom.javaJava · Minecraft 26.2 · 135 lines · 4.5 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.world;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.TickEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.setting.BoolSetting;
8
import com.jellypudding.offlineclient.setting.NumberSetting;
9
import com.jellypudding.offlineclient.util.BlockMiner;
10
import com.jellypudding.offlineclient.util.BlockUtil;
11
import com.jellypudding.offlineclient.util.ChatUtil;
12
import net.minecraft.core.BlockPos;
13
import net.minecraft.core.particles.ParticleTypes;
14
import net.minecraft.sounds.SoundEvents;
15
import net.minecraft.sounds.SoundSource;
16
import net.minecraft.world.phys.Vec3;
17
18
import java.util.ArrayList;
19
import java.util.Comparator;
20
import java.util.List;
21
22
// The server keeps only one break at a time. The same block is sent over and over
23
// to force it through. That is a lot of packets and a strict server will kick you.
24
public final class Kaboom extends Module {
25
26
    // How far the blast reaches. Past this the server refuses the packets anyway.
27
    private static final double RADIUS = 6;
28
29
    private final NumberSetting power = new NumberSetting("Power",
30
        "How many times each block is hit.", 128, 32, 512, 32).min(1);
31
    private final NumberSetting rate = new NumberSetting("Packets a tick",
32
        "Spread over ticks so the server has a chance to keep up.", 600, 100, 4000, 100).min(1);
33
    private final BoolSetting sound = new BoolSetting("Sound",
34
        "Play an explosion for yourself.", true);
35
    private final BoolSetting particles = new BoolSetting("Particles",
36
        "Show an explosion for yourself.", true);
37
38
    private final List<BlockPos> targets = new ArrayList<>();
39
    private int roundsLeft;
40
    private int next;
41
42
    public Kaboom() {
43
        super("Kaboom", "Blows a hole around you in one go.", Category.WORLD);
44
        addSettings(power, rate, sound, particles);
45
        searchTags("explode", "boom", "instant mine");
46
    }
47
48
    @Override
49
    public boolean savesEnabledState() {
50
        return false;
51
    }
52
53
    @Override
54
    public String getSuffix() {
55
        return roundsLeft == 0 ? null : roundsLeft + " left";
56
    }
57
58
    @Override
59
    protected void onEnable() {
60
        targets.clear();
61
        next = 0;
62
        roundsLeft = 0;
63
        if (!inGame()) {
64
            setEnabled(false);
65
            return;
66
        }
67
        if (!mc.player.onGround() && !mc.player.isCreative()) {
68
            ChatUtil.error("Stand on something first.");
69
            setEnabled(false);
70
            return;
71
        }
72
        gather();
73
        if (targets.isEmpty()) {
74
            ChatUtil.error("There is nothing to break here.");
75
            setEnabled(false);
76
            return;
77
        }
78
        show();
79
        roundsLeft = power.getInt();
80
    }
81
82
    @Override
83
    protected void onDisable() {
84
        targets.clear();
85
        roundsLeft = 0;
86
    }
87
88
    @Subscribe
89
    private void onTick(TickEvent event) {
90
        if (!inGame()) {
91
            setEnabled(false);
92
            return;
93
        }
94
        int budget = rate.getInt();
95
        while (budget > 0 && roundsLeft > 0) {
96
            BlockMiner.breakInstantly(targets.get(next));
97
            budget--;
98
            if (++next >= targets.size()) {
99
                next = 0;
100
                roundsLeft--;
101
            }
102
        }
103
        if (roundsLeft == 0) {
104
            setEnabled(false);
105
        }
106
    }
107
108
    // Furthest first. The walls go before the floor and you do not fall out of reach.
109
    private void gather() {
110
        Vec3 eyes = mc.player.getEyePosition();
111
        for (BlockPos pos : BlockUtil.positionsAround(mc.player.blockPosition(), (int) RADIUS)) {
112
            if (BlockUtil.state(pos).isAir()) {
113
                continue;
114
            }
115
            if (eyes.distanceToSqr(Vec3.atCenterOf(pos)) <= RADIUS * RADIUS) {
116
                targets.add(pos.immutable());
117
            }
118
        }
119
        targets.sort(Comparator.comparingDouble(
120
            (BlockPos pos) -> eyes.distanceToSqr(Vec3.atCenterOf(pos))).reversed());
121
    }
122
123
    private void show() {
124
        Vec3 middle = mc.player.position();
125
        if (sound.isOn()) {
126
            mc.level.playLocalSound(middle.x, middle.y, middle.z,
127
                SoundEvents.GENERIC_EXPLODE.value(), SoundSource.BLOCKS, 4f, 1f, false);
128
        }
129
        if (particles.isOn()) {
130
            mc.level.addParticle(ParticleTypes.EXPLOSION_EMITTER,
131
                middle.x, middle.y, middle.z, 1, 0, 0);
132
        }
133
    }
134
}
135