InstantBunker module

InstantBunker: 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/InstantBunker.javaJava · 102 lines · 3.9 KB

Builds a small bunker round you in one jump.

SettingsRotate
InstantBunker.javaJava · Minecraft 26.2 · 102 lines · 3.9 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.util.BlockUtil;
9
import com.jellypudding.offlineclient.util.ChatUtil;
10
import net.minecraft.core.BlockPos;
11
import net.minecraft.core.Direction;
12
import net.minecraft.world.InteractionHand;
13
import net.minecraft.world.item.BlockItem;
14
import net.minecraft.world.item.ItemStack;
15
16
import java.util.ArrayList;
17
import java.util.List;
18
19
// Jumps and drops a five by five shell round you before you land.
20
public final class InstantBunker extends Module {
21
22
    // Every block of the shell as sideways then up then forward from your feet.
23
    private static final int[][] SHELL = {
24
        {2, 0, 2}, {-2, 0, 2}, {2, 0, -2}, {-2, 0, -2}, {2, 1, 2}, {-2, 1, 2}, {2, 1, -2},
25
        {-2, 1, -2}, {2, 2, 2}, {-2, 2, 2}, {2, 2, -2}, {-2, 2, -2}, {1, 2, 2}, {0, 2, 2},
26
        {-1, 2, 2}, {2, 2, 1}, {2, 2, 0}, {2, 2, -1}, {-2, 2, 1}, {-2, 2, 0}, {-2, 2, -1},
27
        {1, 2, -2}, {0, 2, -2}, {-1, 2, -2}, {1, 0, 2}, {0, 0, 2}, {-1, 0, 2}, {2, 0, 1},
28
        {2, 0, 0}, {2, 0, -1}, {-2, 0, 1}, {-2, 0, 0}, {-2, 0, -1}, {1, 0, -2}, {0, 0, -2},
29
        {-1, 0, -2}, {1, 1, 2}, {0, 1, 2}, {-1, 1, 2}, {2, 1, 1}, {2, 1, 0}, {2, 1, -1},
30
        {-2, 1, 1}, {-2, 1, 0}, {-2, 1, -1}, {1, 1, -2}, {0, 1, -2}, {-1, 1, -2}, {1, 2, 1},
31
        {-1, 2, 1}, {1, 2, -1}, {-1, 2, -1}, {0, 2, 1}, {1, 2, 0}, {-1, 2, 0}, {0, 2, -1},
32
        {0, 2, 0}};
33
34
    // Ticks after the jump before the first block goes down.
35
    private static final int LIFT_OFF = 2;
36
37
    private final BoolSetting rotate = new BoolSetting("Rotate",
38
        "Turns towards each block on the server side.", false);
39
40
    private final List<BlockPos> shell = new ArrayList<>();
41
    private int timer;
42
43
    public InstantBunker() {
44
        super("InstantBunker", "Builds a small bunker round you in one jump.", Category.WORLD);
45
        addSettings(rotate);
46
        searchTags("bunker", "instant base", "panic room");
47
    }
48
49
    @Override
50
    public boolean savesEnabledState() {
51
        return false;
52
    }
53
54
    @Override
55
    protected void onEnable() {
56
        if (!inGame()) {
57
            setEnabled(false);
58
            return;
59
        }
60
        if (!mc.player.onGround()) {
61
            ChatUtil.error("You need to be standing on the ground.");
62
            setEnabled(false);
63
            return;
64
        }
65
        ItemStack held = mc.player.getMainHandItem();
66
        if (!(held.getItem() instanceof BlockItem)) {
67
            ChatUtil.error("Hold the blocks in your main hand.");
68
            setEnabled(false);
69
            return;
70
        }
71
        if (held.getCount() < SHELL.length && !mc.player.getAbilities().instabuild) {
72
            ChatUtil.message("Fewer than " + SHELL.length + " blocks. The bunker may have gaps.");
73
        }
74
        BlockPos feet = BlockPos.containing(mc.player.position());
75
        Direction forward = mc.player.getDirection();
76
        Direction sideways = forward.getCounterClockWise();
77
        shell.clear();
78
        for (int[] offset : SHELL) {
79
            shell.add(feet.above(offset[1]).relative(forward, offset[2])
80
                .relative(sideways, offset[0]));
81
        }
82
        timer = LIFT_OFF;
83
        mc.player.jumpFromGround();
84
    }
85
86
    @Subscribe
87
    private void onTick(TickEvent event) {
88
        if (!inGame() || timer-- > 0) {
89
            return;
90
        }
91
        for (BlockPos pos : shell) {
92
            if (BlockUtil.isReplaceable(pos) && !BlockUtil.intersectsPlayer(pos)) {
93
                BlockUtil.placeAny(pos, rotate.isOn(), false);
94
            }
95
        }
96
        mc.player.swing(InteractionHand.MAIN_HAND);
97
        if (mc.player.onGround()) {
98
            setEnabled(false);
99
        }
100
    }
101
}
102