light-overlay module

light-overlay: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

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.

Meteor ClientRendersrc/main/java/meteordevelopment/meteorclient/systems/modules/render/LightOverlay.javaJava · 138 lines · 4.5 KB

Shows blocks where mobs can spawn.

Settingshorizontal-rangevertical-rangesee-through-blockslight-levelcolorpotential-color
LightOverlay.javaJava · Minecraft 26.2 · 138 lines · 4.5 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.render;
7
8
import meteordevelopment.meteorclient.events.render.Render3DEvent;
9
import meteordevelopment.meteorclient.events.world.TickEvent;
10
import meteordevelopment.meteorclient.renderer.Renderer3D;
11
import meteordevelopment.meteorclient.settings.*;
12
import meteordevelopment.meteorclient.systems.modules.Categories;
13
import meteordevelopment.meteorclient.systems.modules.Module;
14
import meteordevelopment.meteorclient.utils.misc.Pool;
15
import meteordevelopment.meteorclient.utils.render.color.Color;
16
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
17
import meteordevelopment.meteorclient.utils.world.BlockIterator;
18
import meteordevelopment.meteorclient.utils.world.BlockUtils;
19
import meteordevelopment.orbit.EventHandler;
20
import net.minecraft.core.BlockPos;
21
22
import java.util.ArrayList;
23
import java.util.List;
24
25
public class LightOverlay extends Module {
26
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
27
    private final SettingGroup sgColors = settings.createGroup("Colors");
28
29
    // General
30
31
    private final Setting<Integer> horizontalRange = sgGeneral.add(new IntSetting.Builder()
32
        .name("horizontal-range")
33
        .description("Horizontal range in blocks.")
34
        .defaultValue(8)
35
        .min(0)
36
        .build()
37
    );
38
39
    private final Setting<Integer> verticalRange = sgGeneral.add(new IntSetting.Builder()
40
        .name("vertical-range")
41
        .description("Vertical range in blocks.")
42
        .defaultValue(4)
43
        .min(0)
44
        .build()
45
    );
46
47
    private final Setting<Boolean> seeThroughBlocks = sgGeneral.add(new BoolSetting.Builder()
48
        .name("see-through-blocks")
49
        .description("Allows you to see the lines through blocks.")
50
        .defaultValue(false)
51
        .build()
52
    );
53
54
    private final Setting<Integer> lightLevel = sgGeneral.add(new IntSetting.Builder()
55
        .name("light-level")
56
        .description("Which light levels to render. Old spawning light: 7.")
57
        .defaultValue(0)
58
        .min(0)
59
        .sliderMax(15)
60
        .build()
61
    );
62
63
    // Colors
64
65
    private final Setting<SettingColor> color = sgColors.add(new ColorSetting.Builder()
66
        .name("color")
67
        .description("Color of places where mobs can currently spawn.")
68
        .defaultValue(new SettingColor(225, 25, 25))
69
        .build()
70
    );
71
72
    private final Setting<SettingColor> potentialColor = sgColors.add(new ColorSetting.Builder()
73
        .name("potential-color")
74
        .description("Color of places where mobs can potentially spawn (eg at night).")
75
        .defaultValue(new SettingColor(225, 225, 25))
76
        .build()
77
    );
78
79
    private final Pool<Cross> crossPool = new Pool<>(Cross::new);
80
    private final List<Cross> crosses = new ArrayList<>();
81
82
    public LightOverlay() {
83
        super(Categories.Render, "light-overlay", "Shows blocks where mobs can spawn.");
84
    }
85
86
    @EventHandler
87
    private void onTick(TickEvent.Pre event) {
88
        crossPool.freeAll(crosses);
89
        crosses.clear();
90
91
        BlockIterator.register(horizontalRange.get(), verticalRange.get(), (blockPos, blockState) -> {
92
            switch (BlockUtils.isValidMobSpawn(blockPos, blockState, lightLevel.get())) {
93
                case Potential -> crosses.add(crossPool.get().set(blockPos, true));
94
                case Always -> crosses.add((crossPool.get().set(blockPos, false)));
95
            }
96
        });
97
    }
98
99
    @EventHandler
100
    private void onRender(Render3DEvent event) {
101
        if (crosses.isEmpty()) return;
102
103
        Renderer3D renderer = seeThroughBlocks.get() ? event.renderer : event.depthRenderer;
104
105
        for (Cross cross : crosses) {
106
            cross.render(renderer);
107
        }
108
    }
109
110
    private class Cross {
111
        private double x, y, z;
112
        private boolean potential;
113
114
        public Cross set(BlockPos blockPos, boolean potential) {
115
            x = blockPos.getX();
116
            y = blockPos.getY() + 0.0075;
117
            z = blockPos.getZ();
118
119
            this.potential = potential;
120
121
            return this;
122
        }
123
124
        public void render(Renderer3D renderer) {
125
            Color c = potential ? potentialColor.get() : color.get();
126
127
            renderer.line(x, y, z, x + 1, y, z + 1, c);
128
            renderer.line(x + 1, y, z, x, y, z + 1, c);
129
        }
130
    }
131
132
    public enum Spawn {
133
        Never,
134
        Potential,
135
        Always
136
    }
137
}
138