CityESP module

CityESP: 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/CityEsp.javaJava · 105 lines · 3.6 KB

Highlights the block that would open up a surrounded enemy.

SettingsTarget rangeBreak rangeNearest onlyThrough walls
CityEsp.javaJava · Minecraft 26.2 · 105 lines · 3.6 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.modules.combat.AutoCity;
9
import com.jellypudding.offlineclient.render.BoxStyle;
10
import com.jellypudding.offlineclient.render.DrawBatch;
11
import com.jellypudding.offlineclient.setting.BoolSetting;
12
import com.jellypudding.offlineclient.setting.NumberSetting;
13
import com.jellypudding.offlineclient.util.BlockUtil;
14
import com.jellypudding.offlineclient.util.EntityUtil;
15
import net.minecraft.core.BlockPos;
16
import net.minecraft.world.entity.player.Player;
17
18
import java.util.ArrayList;
19
import java.util.List;
20
21
// The pick matches what AutoCity would mine.
22
public final class CityEsp extends Module {
23
24
    private final NumberSetting targetRange = new NumberSetting("Target range",
25
        "How far away enemies are considered.", 6, 1, 16, 0.5, " blocks").max(64);
26
    private final NumberSetting breakRange = new NumberSetting("Break range",
27
        "How far you can reach to mine.", 4.5, 1, 6, 0.1).min(1);
28
    private final BoolSetting nearestOnly = new BoolSetting("Nearest only",
29
        "Only mark the closest enemy.", false);
30
    private final BoxStyle style = new BoxStyle(BoxStyle.Shape.BOTH, 0);
31
    private final BoolSetting throughWalls = new BoolSetting("Through walls",
32
        "Show boxes behind blocks.", true);
33
34
    private final List<BlockPos> targets = new ArrayList<>();
35
36
    public CityEsp() {
37
        super("CityESP", "Highlights the block that would open up a surrounded enemy.", Category.RENDER);
38
        addSettings(targetRange, breakRange, nearestOnly);
39
        addSettings(style.settings());
40
        addSettings(throughWalls);
41
        searchTags("city", "surround", "obsidian", "autocity");
42
    }
43
44
    @Override
45
    public String getSuffix() {
46
        return count(targets.size());
47
    }
48
49
    @Override
50
    protected void onDisable() {
51
        targets.clear();
52
    }
53
54
    @Subscribe
55
    private void onTick(TickEvent event) {
56
        targets.clear();
57
        if (!inGame() || mc.player.isSpectator()) {
58
            return;
59
        }
60
        double reach = breakRange.getValue();
61
        if (nearestOnly.isOn()) {
62
            Player nearest = EntityUtil.nearestEnemy(targetRange.getValue());
63
            addTarget(nearest, reach);
64
            return;
65
        }
66
        for (Player player : mc.level.players()) {
67
            if (player == mc.player || !player.isAlive() || player.isSpectator()) {
68
                continue;
69
            }
70
            if (EntityUtil.isFriend(player)) {
71
                continue;
72
            }
73
            if (mc.player.distanceTo(player) > targetRange.getValue()) {
74
                continue;
75
            }
76
            addTarget(player, reach);
77
        }
78
    }
79
80
    private void addTarget(Player target, double reach) {
81
        if (target == null) {
82
            return;
83
        }
84
        BlockPos pos = AutoCity.cityBlock(target, reach);
85
        if (pos != null && !targets.contains(pos)) {
86
            targets.add(pos);
87
        }
88
    }
89
90
    @Subscribe
91
    private void onRender3D(Render3DEvent event) {
92
        // A frame can land after the world has gone.
93
        if (targets.isEmpty() || !inGame()) {
94
            return;
95
        }
96
        DrawBatch batch = event.getBatch();
97
        boolean through = throughWalls.isOn();
98
        for (BlockPos pos : targets) {
99
            if (!BlockUtil.state(pos).isAir()) {
100
                style.draw(batch, pos, through);
101
            }
102
        }
103
    }
104
}
105