BuildHeight module

BuildHeight: 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/BuildHeight.javaJava · 76 lines · 2.7 KB

Lets you place blocks against the world height limit.

SettingsLimit
BuildHeight.javaJava · Minecraft 26.2 · 76 lines · 2.7 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.PacketSendEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.setting.EnumSetting;
8
import net.minecraft.core.BlockPos;
9
import net.minecraft.core.Direction;
10
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
11
import net.minecraft.world.phys.BlockHitResult;
12
import java.util.concurrent.atomic.AtomicInteger;
13
14
// Swaps the clicked side on the use packet at the world height limit. The
15
// placement lands in the same spot since only a replaceable block is touched.
16
public final class BuildHeight extends Module {
17
18
    public enum Limit { TOP, BOTTOM, BOTH }
19
20
    private final EnumSetting<Limit> limit = new EnumSetting<>("Limit",
21
        "Which end of the world to work at.", Limit.TOP);
22
23
    private final AtomicInteger swaps = new AtomicInteger();
24
25
    public BuildHeight() {
26
        super("BuildHeight", "Lets you place blocks against the world height limit.", Category.WORLD);
27
        addSettings(limit);
28
        searchTags("height limit", "build limit", "roof", "bedrock");
29
    }
30
31
    @Override
32
    public String getSuffix() {
33
        int count = swaps.get();
34
        return count == 0 ? null : String.valueOf(count);
35
    }
36
37
    @Override
38
    protected void onEnable() {
39
        swaps.set(0);
40
    }
41
42
    @Subscribe(priority = 200)
43
    private void onPacketSend(PacketSendEvent event) {
44
        if (!(event.getPacket() instanceof ServerboundUseItemOnPacket packet)) {
45
            return;
46
        }
47
        // The block state below is only safe to read on the main thread.
48
        if (!mc.isSameThread() || !inGame()) {
49
            return;
50
        }
51
        BlockHitResult hit = packet.getHitResult();
52
        BlockPos pos = hit.getBlockPos();
53
        Direction swapped = swapFor(hit.getDirection(), pos);
54
        if (swapped == null) {
55
            return;
56
        }
57
        // A solid block would send the placement to the neighbour on the other side.
58
        if (!mc.level.getBlockState(pos).canBeReplaced()) {
59
            return;
60
        }
61
        event.setPacket(new ServerboundUseItemOnPacket(packet.getHand(),
62
            hit.withDirection(swapped), packet.getSequence()));
63
        swaps.incrementAndGet();
64
    }
65
66
    private Direction swapFor(Direction side, BlockPos pos) {
67
        if (side == Direction.UP && !limit.is(Limit.BOTTOM) && pos.getY() >= mc.level.getMaxY()) {
68
            return Direction.DOWN;
69
        }
70
        if (side == Direction.DOWN && !limit.is(Limit.TOP) && pos.getY() <= mc.level.getMinY()) {
71
            return Direction.UP;
72
        }
73
        return null;
74
    }
75
}
76