EndermanLook module

EndermanLook: Minecraft 26.3 cheat module, full source for every implementation (1 client: OfflineClient).

1 implementationWORLD

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.

OfflineClientWORLDsrc/main/java/com/jellypudding/offlineclient/modules/world/EndermanLook.javaJava · 91 lines · 3.7 KB

Keeps your gaze off endermen or puts it right on them.

SettingsModeStun angry ones
EndermanLook.javaJava · Minecraft 26.2 · 91 lines · 3.7 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.world;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.TickEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.setting.BoolSetting;
8
import com.jellypudding.offlineclient.setting.EnumSetting;
9
import com.jellypudding.offlineclient.util.RotationManager;
10
import com.jellypudding.offlineclient.util.RotationPriority;
11
import net.minecraft.tags.ItemTags;
12
import net.minecraft.world.entity.Entity;
13
import net.minecraft.world.entity.EquipmentSlot;
14
import net.minecraft.world.entity.monster.EnderMan;
15
import net.minecraft.world.phys.Vec3;
16
17
// The server decides you are staring from the angle it last heard from you.
18
// Holding that angle away from an enderman keeps it calm.
19
public final class EndermanLook extends Module {
20
21
    public enum Mode { AWAY, AT }
22
23
    // How wide the vanilla stare test is before distance widens it.
24
    private static final double STARE_SPREAD = 0.025;
25
26
    // Straight down.
27
    private static final float FLOOR_PITCH = 90f;
28
29
    private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
30
        "What to do about the endermen near you.", Mode.AWAY)
31
        .describe(Mode.AWAY, "Looks at the floor whenever you would stare at one.")
32
        .describe(Mode.AT, "Stares at every calm enderman to wind it up.");
33
    private final BoolSetting stun = new BoolSetting("Stun angry ones",
34
        "Stares at an angry enderman so it freezes instead of closing in.", true)
35
        .under(mode, Mode.AWAY);
36
37
    public EndermanLook() {
38
        super("EndermanLook", "Keeps your gaze off endermen or puts it right on them.", Category.WORLD);
39
        addSettings(mode, stun);
40
        searchTags("enderman", "stare", "gaze");
41
    }
42
43
    @Subscribe
44
    private void onTick(TickEvent event) {
45
        if (!inGame()) {
46
            return;
47
        }
48
        // A carved pumpkin already hides your gaze and creative mode is ignored.
49
        if (mc.player.getItemBySlot(EquipmentSlot.HEAD).is(ItemTags.GAZE_DISGUISE_EQUIPMENT)
50
            || mc.player.getAbilities().instabuild) {
51
            return;
52
        }
53
        for (Entity entity : mc.level.entitiesForRendering()) {
54
            if (!(entity instanceof EnderMan enderman) || !enderman.isAlive()
55
                || !mc.player.hasLineOfSight(enderman)) {
56
                continue;
57
            }
58
            if (mode.is(Mode.AT)) {
59
                if (!enderman.isCreepy()) {
60
                    stareAt(enderman);
61
                    return;
62
                }
63
                continue;
64
            }
65
            if (enderman.isCreepy() && stun.isOn()) {
66
                stareAt(enderman);
67
                return;
68
            }
69
            if (staringAt(enderman)) {
70
                RotationManager.requestExact(mc.player.getYRot(), FLOOR_PITCH, RotationPriority.IDLE);
71
                return;
72
            }
73
        }
74
    }
75
76
    private void stareAt(EnderMan enderman) {
77
        Vec3 head = new Vec3(enderman.getX(), enderman.getEyeY(), enderman.getZ());
78
        RotationManager.requestExact(RotationManager.yawTo(head),
79
            RotationManager.pitchTo(head), RotationPriority.IDLE);
80
    }
81
82
    // The same test the game runs. A distant enderman needs a tighter aim to notice.
83
    private boolean staringAt(EnderMan enderman) {
84
        Vec3 view = mc.player.getViewVector(1f).normalize();
85
        Vec3 toward = new Vec3(enderman.getX() - mc.player.getX(),
86
            enderman.getEyeY() - mc.player.getEyeY(), enderman.getZ() - mc.player.getZ());
87
        double distance = toward.length();
88
        return view.dot(toward.normalize()) > 1 - STARE_SPREAD / distance;
89
    }
90
}
91