SpawnESP module

SpawnESP: 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/SpawnEsp.javaJava · 126 lines · 4.9 KB

Marks the dark floor where mobs can appear.

SettingsHorizontal rangeVertical rangeLightLimitRefreshCrossColourNight colourOpacityHitbox checkThrough walls
SpawnEsp.javaJava · Minecraft 26.2 · 126 lines · 4.9 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.event.events.TickEvent;
6
import com.jellypudding.offlineclient.module.Category;
7
import com.jellypudding.offlineclient.module.Module;
8
import com.jellypudding.offlineclient.render.DrawBatch;
9
import com.jellypudding.offlineclient.setting.BoolSetting;
10
import com.jellypudding.offlineclient.setting.ColorSetting;
11
import com.jellypudding.offlineclient.setting.NumberSetting;
12
import com.jellypudding.offlineclient.util.ColorUtil;
13
import com.jellypudding.offlineclient.util.SpawnUtil;
14
import net.minecraft.core.BlockPos;
15
import net.minecraft.world.phys.Vec3;
16
17
import java.util.ArrayList;
18
import java.util.List;
19
20
public final class SpawnEsp extends Module {
21
22
    // Night marks a spot the sun is keeping clear for now.
23
    private record Spot(BlockPos pos, boolean night) {
24
    }
25
26
    // How far above the floor the marker is drawn.
27
    private static final double LIFT = 0.02;
28
29
    private final NumberSetting horizontal = new NumberSetting("Horizontal range",
30
        "How far sideways to look.", 16, 4, 48, 2, " blocks").max(64);
31
    private final NumberSetting vertical = new NumberSetting("Vertical range",
32
        "How far up and down to look.", 6, 1, 24, 1, " blocks").max(64);
33
    private final NumberSetting light = new NumberSetting("Light",
34
        "Highest block light a spot may have.", 0, 0, 15, 1).min(0).max(15);
35
    private final NumberSetting limit = new NumberSetting("Limit",
36
        "Most spots marked at once.", 600, 100, 4000, 100).min(1);
37
    private final NumberSetting refresh = new NumberSetting("Refresh",
38
        "Ticks between scans.", 10, 1, 60, 1, " ticks").min(1);
39
    private final BoolSetting cross = new BoolSetting("Cross",
40
        "Draw an X inside each square.", true);
41
    private final ColorSetting nowColor = new ColorSetting("Colour",
42
        "Colour of spots where a mob can appear right now.", 0, 0.89f, 0.88f, false);
43
    private final ColorSetting nightColor = new ColorSetting("Night colour",
44
        "Colour of spots that only the sky lights so mobs appear there at night.", 60, 0.89f, 0.88f, false);
45
    private final NumberSetting opacity = new NumberSetting("Opacity",
46
        "How solid the markers are drawn.", 50, 5, 100, 5, "%").min(1).max(100);
47
    private final BoolSetting hitbox = new BoolSetting("Hitbox check",
48
        "Also make sure a whole mob fits in the space. Slower but it rules out tight corners.", false);
49
    private final BoolSetting throughWalls = new BoolSetting("Through walls",
50
        "Show spots behind blocks.", false);
51
52
    private List<Spot> spots = List.of();
53
    private int timer;
54
55
    public SpawnEsp() {
56
        super("SpawnESP", "Marks the dark floor where mobs can appear.", Category.RENDER);
57
        addSettings(horizontal, vertical, light, limit, refresh, cross,
58
            nowColor, nightColor, opacity, hitbox, throughWalls);
59
        searchTags("light overlay", "mob spawn", "spawn proof");
60
    }
61
62
    @Override
63
    public String getSuffix() {
64
        return count(spots.size());
65
    }
66
67
    @Override
68
    protected void onEnable() {
69
        timer = 0;
70
        forget();
71
    }
72
73
    @Override
74
    protected void onDisable() {
75
        forget();
76
    }
77
78
    private void forget() {
79
        spots = List.of();
80
    }
81
82
    @Subscribe
83
    private void onTick(TickEvent event) {
84
        if (!inGame()) {
85
            forget();
86
            return;
87
        }
88
        if (timer > 0) {
89
            timer--;
90
            return;
91
        }
92
        timer = refresh.getInt();
93
        List<Spot> found = new ArrayList<>();
94
        for (BlockPos pos : SpawnUtil.spotsAround(horizontal.getInt(), vertical.getInt(),
95
            light.getInt(), limit.getInt(), hitbox.isOn())) {
96
            found.add(new Spot(pos, SpawnUtil.nightOnly(pos)));
97
        }
98
        spots = found;
99
    }
100
101
    @Subscribe
102
    private void onRender3D(Render3DEvent event) {
103
        DrawBatch batch = event.getBatch();
104
        boolean x = cross.isOn();
105
        boolean through = throughWalls.isOn();
106
        float share = opacity.getFloat() / 100f;
107
        int now = ColorUtil.fade(nowColor.getColor(), share);
108
        int night = ColorUtil.fade(nightColor.getColor(), share);
109
        for (Spot spot : spots) {
110
            BlockPos pos = spot.pos();
111
            int color = spot.night() ? night : now;
112
            double y = pos.getY() + LIFT;
113
            double west = pos.getX();
114
            double east = pos.getX() + 1;
115
            double north = pos.getZ();
116
            double south = pos.getZ() + 1;
117
118
            batch.flatRect(west, north, east, south, y, color, through);
119
            if (x) {
120
                batch.line(new Vec3(west, y, north), new Vec3(east, y, south), color, through);
121
                batch.line(new Vec3(east, y, north), new Vec3(west, y, south), color, through);
122
            }
123
        }
124
    }
125
}
126