BlockSelection module

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

1 implementationRENDER

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.

OfflineClientRENDERsrc/main/java/com/jellypudding/offlineclient/modules/render/BlockSelection.javaJava · 77 lines · 3.1 KB

Recolours the outline on the block you are looking at.

SettingsTrue shapeSingle sideHide inside
BlockSelection.javaJava · Minecraft 26.2 · 77 lines · 3.1 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.render;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.Render3DEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.render.BoxStyle;
8
import com.jellypudding.offlineclient.render.DrawBatch;
9
import com.jellypudding.offlineclient.setting.BoolSetting;
10
import net.minecraft.core.BlockPos;
11
import net.minecraft.world.phys.AABB;
12
import net.minecraft.world.phys.BlockHitResult;
13
import net.minecraft.world.phys.HitResult;
14
import net.minecraft.world.phys.Vec3;
15
import net.minecraft.world.phys.shapes.VoxelShape;
16
17
// LevelRendererMixin drops the vanilla black outline whilst this is on.
18
public final class BlockSelection extends Module {
19
20
    private final BoolSetting trueShape = new BoolSetting("True shape",
21
        "Follow every edge of stairs and fences and slabs rather than a plain cube round them.", true);
22
    private final BoolSetting singleSide = new BoolSetting("Single side",
23
        "Only mark the face you are looking at.", false);
24
    private final BoxStyle style = BoxStyle.white(BoxStyle.Shape.BOTH);
25
    private final BoolSetting hideInside = new BoolSetting("Hide inside",
26
        "Draw nothing whilst your head is inside the block you are looking at.", true);
27
28
    public BlockSelection() {
29
        super("BlockSelection", "Recolours the outline on the block you are looking at.", Category.RENDER);
30
        addSettings(trueShape, singleSide);
31
        addSettings(style.settings());
32
        addSettings(hideInside);
33
        searchTags("outline", "highlight", "crosshair");
34
    }
35
36
    @Subscribe
37
    private void onRender3D(Render3DEvent event) {
38
        if (mc.level == null || !(mc.hitResult instanceof BlockHitResult hit)
39
            || hit.getType() == HitResult.Type.MISS) {
40
            return;
41
        }
42
        if (hideInside.isOn() && hit.isInside()) {
43
            return;
44
        }
45
        BlockPos pos = hit.getBlockPos();
46
        VoxelShape shape = mc.level.getBlockState(pos).getShape(mc.level, pos);
47
        if (shape.isEmpty()) {
48
            return;
49
        }
50
        DrawBatch batch = event.getBatch();
51
        AABB bounds = shape.bounds().move(pos);
52
        if (singleSide.isOn()) {
53
            style.drawFace(batch, bounds, hit.getDirection(), false);
54
        } else if (trueShape.isOn()) {
55
            drawShape(batch, shape, pos);
56
        } else {
57
            style.draw(batch, bounds, false);
58
        }
59
    }
60
61
    // Every edge and every sub box the shape is made of.
62
    private void drawShape(DrawBatch batch, VoxelShape shape, BlockPos pos) {
63
        if (style.drawsLines()) {
64
            int line = style.lineColor();
65
            shape.forAllEdges((x1, y1, z1, x2, y2, z2) -> batch.line(
66
                new Vec3(pos.getX() + x1, pos.getY() + y1, pos.getZ() + z1),
67
                new Vec3(pos.getX() + x2, pos.getY() + y2, pos.getZ() + z2), line, false));
68
        }
69
        if (style.drawsSides()) {
70
            int fill = style.fillColor();
71
            for (AABB part : shape.toAabbs()) {
72
                batch.solidBox(part.move(pos), fill, false);
73
            }
74
        }
75
    }
76
}
77