hole-esp module

hole-esp: 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/HoleESP.javaJava · 329 lines · 13.4 KB

Displays holes that you will take less damage in.

Settingshorizontal-radiusvertical-radiusmin-heightdoublesignore-ownwebsshape-modeheighttop-quadbottom-quadbedrock-topbedrock-bottomobsidian-topobsidian-bottommixed-topmixed-bottom
HoleESP.javaJava · Minecraft 26.2 · 329 lines · 13.4 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.mixin.BlockBehaviourAccessor;
11
import meteordevelopment.meteorclient.renderer.Renderer3D;
12
import meteordevelopment.meteorclient.renderer.ShapeMode;
13
import meteordevelopment.meteorclient.settings.*;
14
import meteordevelopment.meteorclient.systems.modules.Categories;
15
import meteordevelopment.meteorclient.systems.modules.Module;
16
import meteordevelopment.meteorclient.systems.modules.Modules;
17
import meteordevelopment.meteorclient.utils.misc.Pool;
18
import meteordevelopment.meteorclient.utils.render.color.Color;
19
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
20
import meteordevelopment.meteorclient.utils.world.BlockIterator;
21
import meteordevelopment.meteorclient.utils.world.Dir;
22
import meteordevelopment.orbit.EventHandler;
23
import net.minecraft.core.BlockPos;
24
import net.minecraft.core.Direction;
25
import net.minecraft.core.SectionPos;
26
import net.minecraft.world.level.block.Block;
27
import net.minecraft.world.level.block.Blocks;
28
import net.minecraft.world.level.chunk.LevelChunk;
29
30
import java.util.ArrayList;
31
import java.util.List;
32
33
public class HoleESP extends Module {
34
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
35
    private final SettingGroup sgRender = settings.createGroup("Render");
36
37
    // General
38
39
    private final Setting<Integer> horizontalRadius = sgGeneral.add(new IntSetting.Builder()
40
        .name("horizontal-radius")
41
        .description("Horizontal radius in which to search for holes.")
42
        .defaultValue(10)
43
        .min(0)
44
        .sliderMax(32)
45
        .build()
46
    );
47
48
    private final Setting<Integer> verticalRadius = sgGeneral.add(new IntSetting.Builder()
49
        .name("vertical-radius")
50
        .description("Vertical radius in which to search for holes.")
51
        .defaultValue(5)
52
        .min(0)
53
        .sliderMax(32)
54
        .build()
55
    );
56
57
    private final Setting<Integer> holeHeight = sgGeneral.add(new IntSetting.Builder()
58
        .name("min-height")
59
        .description("Minimum hole height required to be rendered.")
60
        .defaultValue(3)
61
        .min(1)
62
        .sliderMin(1)
63
        .build()
64
    );
65
66
    private final Setting<Boolean> doubles = sgGeneral.add(new BoolSetting.Builder()
67
        .name("doubles")
68
        .description("Highlights double holes that can be stood across.")
69
        .defaultValue(true)
70
        .build()
71
    );
72
73
    private final Setting<Boolean> ignoreOwn = sgGeneral.add(new BoolSetting.Builder()
74
        .name("ignore-own")
75
        .description("Ignores rendering the hole you are currently standing in.")
76
        .defaultValue(false)
77
        .build()
78
    );
79
80
    private final Setting<Boolean> webs = sgGeneral.add(new BoolSetting.Builder()
81
        .name("webs")
82
        .description("Whether to show holes that have webs inside of them.")
83
        .defaultValue(false)
84
        .build()
85
    );
86
87
    // Render
88
89
    private final Setting<ShapeMode> shapeMode = sgRender.add(new EnumSetting.Builder<ShapeMode>()
90
        .name("shape-mode")
91
        .description("How the shapes are rendered.")
92
        .defaultValue(ShapeMode.Both)
93
        .build()
94
    );
95
96
    private final Setting<Double> height = sgRender.add(new DoubleSetting.Builder()
97
        .name("height")
98
        .description("The height of rendering.")
99
        .defaultValue(0.2)
100
        .min(0)
101
        .build()
102
    );
103
104
    private final Setting<Boolean> topQuad = sgRender.add(new BoolSetting.Builder()
105
        .name("top-quad")
106
        .description("Whether to render a quad at the top of the hole.")
107
        .defaultValue(true)
108
        .build()
109
    );
110
111
    private final Setting<Boolean> bottomQuad = sgRender.add(new BoolSetting.Builder()
112
        .name("bottom-quad")
113
        .description("Whether to render a quad at the bottom of the hole.")
114
        .defaultValue(false)
115
        .build()
116
    );
117
118
    private final Setting<SettingColor> bedrockColorTop = sgRender.add(new ColorSetting.Builder()
119
        .name("bedrock-top")
120
        .description("The top color for holes that are completely bedrock.")
121
        .defaultValue(new SettingColor(100, 255, 0, 200))
122
        .build()
123
    );
124
125
    private final Setting<SettingColor> bedrockColorBottom = sgRender.add(new ColorSetting.Builder()
126
        .name("bedrock-bottom")
127
        .description("The bottom color for holes that are completely bedrock.")
128
        .defaultValue(new SettingColor(100, 255, 0, 0))
129
        .build()
130
    );
131
132
    private final Setting<SettingColor> obsidianColorTop = sgRender.add(new ColorSetting.Builder()
133
        .name("obsidian-top")
134
        .description("The top color for holes that are completely obsidian.")
135
        .defaultValue(new SettingColor(255, 0, 0, 200))
136
        .build()
137
    );
138
139
    private final Setting<SettingColor> obsidianColorBottom = sgRender.add(new ColorSetting.Builder()
140
        .name("obsidian-bottom")
141
        .description("The bottom color for holes that are completely obsidian.")
142
        .defaultValue(new SettingColor(255, 0, 0, 0))
143
        .build()
144
    );
145
146
    private final Setting<SettingColor> mixedColorTop = sgRender.add(new ColorSetting.Builder()
147
        .name("mixed-top")
148
        .description("The top color for holes that have mixed bedrock and obsidian.")
149
        .defaultValue(new SettingColor(255, 127, 0, 200))
150
        .build()
151
    );
152
153
    private final Setting<SettingColor> mixedColorBottom = sgRender.add(new ColorSetting.Builder()
154
        .name("mixed-bottom")
155
        .description("The bottom color for holes that have mixed bedrock and obsidian.")
156
        .defaultValue(new SettingColor(255, 127, 0, 0))
157
        .build()
158
    );
159
160
    private final Pool<Hole> holePool = new Pool<>(Hole::new);
161
    private final List<Hole> holes = new ArrayList<>();
162
163
    private final byte NULL = 0;
164
165
    public HoleESP() {
166
        super(Categories.Render, "hole-esp", "Displays holes that you will take less damage in.");
167
    }
168
169
    @EventHandler
170
    private void onTick(TickEvent.Pre event) {
171
        holePool.freeAll(holes);
172
        holes.clear();
173
174
        // Probe for holes
175
        BlockIterator.register(horizontalRadius.get(), verticalRadius.get(), (blockPos, _) -> {
176
            if (!validHole(blockPos)) return;
177
178
            int bedrock = 0, obsidian = 0;
179
            Direction air = null;
180
181
            for (Direction direction : Direction.values()) {
182
                if (direction == Direction.UP) continue;
183
                BlockPos offsetPos = blockPos.relative(direction);
184
                Block block = mc.level.getBlockState(offsetPos).getBlock();
185
                boolean breakable = block.defaultDestroyTime() >= 0;
186
187
                if (((BlockBehaviourAccessor) block).meteor$isHasCollision() && !breakable) bedrock++;
188
                else if (block.getExplosionResistance() >= 600 && breakable) obsidian++;
189
                else if (direction == Direction.DOWN) return;
190
                else if (doubles.get() && air == null && validHole(offsetPos)) {
191
                    for (Direction dir : Direction.values()) {
192
                        if (dir == direction.getOpposite() || dir == Direction.UP) continue;
193
194
                        block = mc.level.getBlockState(offsetPos.relative(dir)).getBlock();
195
                        breakable = block.defaultDestroyTime() >= 0;
196
197
                        if (((BlockBehaviourAccessor) block).meteor$isHasCollision() && !breakable) bedrock++;
198
                        else if (block.getExplosionResistance() >= 600 && breakable) obsidian++;
199
                        else return;
200
                    }
201
202
                    air = direction;
203
                }
204
            }
205
206
            if (obsidian + bedrock == 5 && air == null) {
207
                holes.add(holePool.get().set(blockPos, obsidian == 5 ? Hole.Type.Obsidian : (bedrock == 5 ? Hole.Type.Bedrock : Hole.Type.Mixed), NULL));
208
            } else if (obsidian + bedrock == 8 && doubles.get() && air != null) {
209
                holes.add(holePool.get().set(blockPos, obsidian == 8 ? Hole.Type.Obsidian : (bedrock == 8 ? Hole.Type.Bedrock : Hole.Type.Mixed), Dir.get(air)));
210
            }
211
        });
212
    }
213
214
    private boolean validHole(BlockPos pos) {
215
        if (ignoreOwn.get() && mc.player.blockPosition().equals(pos)) return false;
216
217
        LevelChunk chunk = mc.level.getChunk(SectionPos.posToSectionCoord(pos.getX()), SectionPos.posToSectionCoord(pos.getZ()));
218
        Block block = chunk.getBlockState(pos).getBlock();
219
        if (!webs.get() && block == Blocks.COBWEB) return false;
220
221
        if (((BlockBehaviourAccessor) block).meteor$isHasCollision()) return false;
222
223
        for (int i = 0; i < holeHeight.get(); i++) {
224
            if (((BlockBehaviourAccessor) chunk.getBlockState(pos.above(i)).getBlock()).meteor$isHasCollision())
225
                return false;
226
        }
227
228
        return true;
229
    }
230
231
    @EventHandler
232
    private void onRender(Render3DEvent event) {
233
        for (Hole hole : holes)
234
            hole.render(event.renderer, shapeMode.get(), height.get(), topQuad.get(), bottomQuad.get());
235
    }
236
237
    private static class Hole {
238
        public BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos();
239
        public byte exclude;
240
        public Type type;
241
242
        public Hole set(BlockPos blockPos, Type type, byte exclude) {
243
            this.blockPos.set(blockPos);
244
            this.exclude = exclude;
245
            this.type = type;
246
247
            return this;
248
        }
249
250
        public Color getTopColor() {
251
            return switch (this.type) {
252
                case Obsidian -> Modules.get().get(HoleESP.class).obsidianColorTop.get();
253
                case Bedrock -> Modules.get().get(HoleESP.class).bedrockColorTop.get();
254
                default -> Modules.get().get(HoleESP.class).mixedColorTop.get();
255
            };
256
        }
257
258
        public Color getBottomColor() {
259
            return switch (this.type) {
260
                case Obsidian -> Modules.get().get(HoleESP.class).obsidianColorBottom.get();
261
                case Bedrock -> Modules.get().get(HoleESP.class).bedrockColorBottom.get();
262
                default -> Modules.get().get(HoleESP.class).mixedColorBottom.get();
263
            };
264
        }
265
266
        public void render(Renderer3D renderer, ShapeMode mode, double height, boolean topQuad, boolean bottomQuad) {
267
            int x = blockPos.getX();
268
            int y = blockPos.getY();
269
            int z = blockPos.getZ();
270
271
            Color top = getTopColor();
272
            Color bottom = getBottomColor();
273
274
            int originalTopA = top.a;
275
            int originalBottompA = bottom.a;
276
277
            if (mode.lines()) {
278
                if (Dir.isNot(exclude, Dir.WEST) && Dir.isNot(exclude, Dir.NORTH))
279
                    renderer.line(x, y, z, x, y + height, z, bottom, top);
280
                if (Dir.isNot(exclude, Dir.WEST) && Dir.isNot(exclude, Dir.SOUTH))
281
                    renderer.line(x, y, z + 1, x, y + height, z + 1, bottom, top);
282
                if (Dir.isNot(exclude, Dir.EAST) && Dir.isNot(exclude, Dir.NORTH))
283
                    renderer.line(x + 1, y, z, x + 1, y + height, z, bottom, top);
284
                if (Dir.isNot(exclude, Dir.EAST) && Dir.isNot(exclude, Dir.SOUTH))
285
                    renderer.line(x + 1, y, z + 1, x + 1, y + height, z + 1, bottom, top);
286
287
                if (Dir.isNot(exclude, Dir.NORTH)) renderer.line(x, y, z, x + 1, y, z, bottom);
288
                if (Dir.isNot(exclude, Dir.NORTH)) renderer.line(x, y + height, z, x + 1, y + height, z, top);
289
                if (Dir.isNot(exclude, Dir.SOUTH)) renderer.line(x, y, z + 1, x + 1, y, z + 1, bottom);
290
                if (Dir.isNot(exclude, Dir.SOUTH)) renderer.line(x, y + height, z + 1, x + 1, y + height, z + 1, top);
291
292
                if (Dir.isNot(exclude, Dir.WEST)) renderer.line(x, y, z, x, y, z + 1, bottom);
293
                if (Dir.isNot(exclude, Dir.WEST)) renderer.line(x, y + height, z, x, y + height, z + 1, top);
294
                if (Dir.isNot(exclude, Dir.EAST)) renderer.line(x + 1, y, z, x + 1, y, z + 1, bottom);
295
                if (Dir.isNot(exclude, Dir.EAST)) renderer.line(x + 1, y + height, z, x + 1, y + height, z + 1, top);
296
            }
297
298
            if (mode.sides()) {
299
                top.a = originalTopA / 2;
300
                bottom.a = originalBottompA / 2;
301
302
                if (Dir.isNot(exclude, Dir.UP) && topQuad)
303
                    renderer.quad(x, y + height, z, x, y + height, z + 1, x + 1, y + height, z + 1, x + 1, y + height, z, top); // Top
304
                if (Dir.isNot(exclude, Dir.DOWN) && bottomQuad)
305
                    renderer.quad(x, y, z, x, y, z + 1, x + 1, y, z + 1, x + 1, y, z, bottom); // Bottom
306
307
                if (Dir.isNot(exclude, Dir.NORTH))
308
                    renderer.gradientQuadVertical(x, y, z, x + 1, y + height, z, top, bottom); // North
309
                if (Dir.isNot(exclude, Dir.SOUTH))
310
                    renderer.gradientQuadVertical(x, y, z + 1, x + 1, y + height, z + 1, top, bottom); // South
311
312
                if (Dir.isNot(exclude, Dir.WEST))
313
                    renderer.gradientQuadVertical(x, y, z, x, y + height, z + 1, top, bottom); // West
314
                if (Dir.isNot(exclude, Dir.EAST))
315
                    renderer.gradientQuadVertical(x + 1, y, z, x + 1, y + height, z + 1, top, bottom); // East
316
317
                top.a = originalTopA;
318
                bottom.a = originalBottompA;
319
            }
320
        }
321
322
        public enum Type {
323
            Bedrock,
324
            Obsidian,
325
            Mixed
326
        }
327
    }
328
}
329