OpenWaterESP module

OpenWaterESP: 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/OpenWaterEsp.javaJava · 115 lines · 4.5 KB

Shows whether your bobber sits in open water.

SettingsOpen colourShallow colourCross
OpenWaterEsp.javaJava · Minecraft 26.2 · 115 lines · 4.5 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.BoxStyle;
9
import com.jellypudding.offlineclient.render.DrawBatch;
10
import com.jellypudding.offlineclient.setting.BoolSetting;
11
import com.jellypudding.offlineclient.setting.ColorSetting;
12
import net.minecraft.core.BlockPos;
13
import net.minecraft.tags.FluidTags;
14
import net.minecraft.world.entity.projectile.FishingHook;
15
import net.minecraft.world.phys.AABB;
16
import net.minecraft.world.phys.Vec3;
17
18
// Open water is a five by five column of water with two air blocks above the bobber.
19
// Only open water gives treasure. This scans once a tick rather than every frame.
20
public final class OpenWaterEsp extends Module {
21
22
    private final BoxStyle style = BoxStyle.shapeOnly(BoxStyle.Shape.LINES);
23
    private final ColorSetting openColor = new ColorSetting("Open colour",
24
        "Colour whilst the bobber sits in open water.", 120, 0.79f, 0.88f, false);
25
    private final ColorSetting shallowColor = new ColorSetting("Shallow colour",
26
        "Colour whilst the water is too shallow for treasure.", 0, 0.79f, 0.88f, false);
27
    private final BoolSetting cross = new BoolSetting("Cross",
28
        "Draw a cross over every face whilst the water is too shallow.", true);
29
30
    // Null whilst no bobber is out.
31
    private AABB box;
32
    private boolean open;
33
34
    public OpenWaterEsp() {
35
        super("OpenWaterESP", "Shows whether your bobber sits in open water.", Category.RENDER);
36
        addSettings(style.settings());
37
        addSettings(openColor, shallowColor, cross);
38
        searchTags("fishing", "treasure", "auto fish esp");
39
    }
40
41
    @Override
42
    public String getSuffix() {
43
        if (box == null) {
44
            return null;
45
        }
46
        return open ? "open" : "shallow";
47
    }
48
49
    @Override
50
    protected void onDisable() {
51
        box = null;
52
    }
53
54
    @Subscribe
55
    private void onTick(TickEvent event) {
56
        FishingHook bobber = inGame() ? mc.player.fishing : null;
57
        if (bobber == null) {
58
            box = null;
59
            return;
60
        }
61
        BlockPos surface = surfaceOf(bobber);
62
        open = bobber.calculateOpenWater(surface);
63
        box = new AABB(-2, -1, -2, 3, 3, 3).move(surface);
64
    }
65
66
    // The water block the bobber floats in. A bobber riding high sits in the air block above it.
67
    private BlockPos surfaceOf(FishingHook bobber) {
68
        BlockPos pos = bobber.blockPosition();
69
        if (mc.level.getFluidState(pos).is(FluidTags.WATER)) {
70
            return pos;
71
        }
72
        BlockPos below = pos.below();
73
        return mc.level.getFluidState(below).is(FluidTags.WATER) ? below : pos;
74
    }
75
76
    @Subscribe
77
    private void onRender3D(Render3DEvent event) {
78
        if (box == null) {
79
            return;
80
        }
81
        DrawBatch batch = event.getBatch();
82
        int color = open ? openColor.getColor() : shallowColor.getColor();
83
        style.draw(batch, box, color, false);
84
        if (!open && cross.isOn()) {
85
            drawCross(batch, color);
86
        }
87
    }
88
89
    // Both diagonals of all six faces. The shallow box reads as barred off.
90
    private void drawCross(DrawBatch batch, int color) {
91
        for (int axis = 0; axis < 3; axis++) {
92
            for (int side = 0; side < 2; side++) {
93
                Vec3[] corners = face(axis, side);
94
                batch.line(corners[0], corners[2], color, false);
95
                batch.line(corners[1], corners[3], color, false);
96
            }
97
        }
98
    }
99
100
    // The four corners of one face in order around it.
101
    private Vec3[] face(int axis, int side) {
102
        double x = side == 0 ? box.minX : box.maxX;
103
        double y = side == 0 ? box.minY : box.maxY;
104
        double z = side == 0 ? box.minZ : box.maxZ;
105
        return switch (axis) {
106
            case 0 -> new Vec3[] {new Vec3(x, box.minY, box.minZ), new Vec3(x, box.minY, box.maxZ),
107
                new Vec3(x, box.maxY, box.maxZ), new Vec3(x, box.maxY, box.minZ)};
108
            case 1 -> new Vec3[] {new Vec3(box.minX, y, box.minZ), new Vec3(box.maxX, y, box.minZ),
109
                new Vec3(box.maxX, y, box.maxZ), new Vec3(box.minX, y, box.maxZ)};
110
            default -> new Vec3[] {new Vec3(box.minX, box.minY, z), new Vec3(box.maxX, box.minY, z),
111
                new Vec3(box.maxX, box.maxY, z), new Vec3(box.minX, box.maxY, z)};
112
        };
113
    }
114
}
115