Memeware 7.3 Derp module 2 files, 118 lines

Memeware 7.3 Derp: Full Source Analysis

Memeware's Derp spins the player's yaw 22 degrees per tick on every pre-update event, wrapping from -180 back to 180, and writes the spun value into the C03 look stream through event.setYaw as well…

me/memewaredevs/client/module/player/Derp.java · GitHub source ↗

Published 2026-08-12 · Updated 2026-08-12

Packets This Module Uses

Analysis

Overview

Memeware's Derp spins the player's yaw 22 degrees per tick on every pre-update event, wrapping from -180 back to 180, and writes the spun value into the C03 look stream through event.setYaw as well as into renderYawOffset and rotationYawHead for the visible body. The pitch branch is commented out, and the spin pauses while AutoPotion.isPotting() is true. The module is constructed with explicit arguments from ModuleManager rather than a no-arg constructor, which is the registration detail that explains its parametrized constructor.

Rotation rewrite

EntityPlayerSP.func_175161_p builds the pre UpdateEvent from the player's current position, yaw and pitch, and after firing it reads event.getYaw() and event.getPitch() to build the C03 variant (C05 look or C06 position-look, EntityPlayerSP lines 181-188). The handler subtracts 22 from the module's yaw field every pre event, resets the field to 180 when it passes -180, and calls event.setYaw, so the look the server sees rotates continuously. renderYawOffset and rotationYawHead carry the same value so the client-side body and head match the wire rotation.

Wire fingerprint

Every tick carries a C03 look packet with a yaw delta of exactly -22 degrees, and on the wrap tick the raw value jumps from -176 to 180, a +356 degree discontinuity (the shortest-distance delta is only 4 degrees). The pitch is never touched, so the look stream is a constant one-axis spin at integer steps. AutoPotion.isPotting() pauses the handler while the potion throw sequence runs, so the spin has gaps during auto-potion use.

Detection surface

The rotation-pattern checks that counter the spin are indexed in the C0A-mined corpus even though the module itself never swings: the animation corpus carries the rotation-analysis family (Photon PacketAnalysis AimStep and PerfectRotation), Hawk's look heuristics, and intave's rotation heuristics, because the mining keywords for that packet overlap the aim and rotation domain. Photon AimStep fires on every tick of the spin, Photon PerfectRotation fires on the exact integer deltas, Hawk AimbotHeuristic fires on the wrap discontinuity while the player is clicking, and intave RotationSnapHeuristic misses the uniform spin entirely, which is itself the finding.

source Derp.java

Derp.java34 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.module.player;
3
4
import me.hippo.api.lwjeb.annotation.Handler;
5
import me.memewaredevs.client.event.events.UpdateEvent;
6
import me.memewaredevs.client.module.Module;
7
import me.memewaredevs.client.module.combat.AutoPotion;
8
9
import java.util.function.Consumer;
10
11
public class Derp extends Module {
12
    private float yaw;
13
14
    public Derp(final String name, final int key, final Module.Category category) {
15
        super(name, key, category);
16
    }
17
18
    @Handler
19
    public Consumer<UpdateEvent> onUpdate = (event) -> {
20
        if (AutoPotion.isPotting()) {
21
            return;
22
        }
23
        if (event.isPre()) {
24
            this.yaw -= 22.0f;
25
            if (this.yaw <= -180.0f) {
26
                this.yaw = 180.0f;
27
            }
28
            this.mc.thePlayer.renderYawOffset = this.yaw;
29
            this.mc.thePlayer.rotationYawHead = this.yaw;
30
            event.setYaw(this.yaw);
31
//			event.setPitch(180);
32
        }
33
    };
34
}

What this file does

The module is a single handler with two guards and one mutation. The AutoPotion.isPotting() gate pauses the spin while the combat module throws, the pre-event check confines the mutation to the packet-bearing phase of the update, and the body subtracts 22 from the yaw field, wraps it at -180, then writes renderYawOffset, rotationYawHead and the event yaw. The commented-out setPitch(180) line is dead code that would have made the spin a full look spoof; as shipped the pitch stays the player's real pitch.

The constructor takes a name, key and category instead of hard-coding them, and ModuleManager registers the instance as new Derp("Derp", 0, Module.Category.PLAYER), which is why the module is constructed with arguments rather than a no-arg form. The yaw field starts at 0, so the first tick sends -22, and the spin completes one revolution every 16 to 17 ticks, about 1.2 rotations per second.

source UpdateEvent.java (pre-update carrier)

UpdateEvent.java84 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.event.events;
3
4
import me.memewaredevs.client.event.Event;
5
6
public class UpdateEvent extends Event {
7
    private double x;
8
    private double y;
9
    private double z;
10
    private float yaw;
11
    private float pitch;
12
    private boolean ground;
13
14
    public UpdateEvent(double x, double y, double z, float yaw, float pitch, boolean ground) {
15
        this.x = x;
16
        this.y = y;
17
        this.z = z;
18
        this.yaw = yaw;
19
        this.pitch = pitch;
20
        this.ground = ground;
21
        this.pre = true;
22
    }
23
24
    public UpdateEvent() {
25
        this.pre = false;
26
    }
27
28
    public double getX() {
29
        return this.x;
30
    }
31
32
    public void setX(double x) {
33
        this.x = x;
34
    }
35
36
    public double getY() {
37
        return this.y;
38
    }
39
40
    public void setY(double y) {
41
        this.y = y;
42
    }
43
44
    public double getZ() {
45
        return this.z;
46
    }
47
48
    public void setZ(double z) {
49
        this.z = z;
50
    }
51
52
    public float getYaw() {
53
        return this.yaw;
54
    }
55
56
    public void setYaw(float yaw) {
57
        this.yaw = yaw;
58
    }
59
60
    public float getPitch() {
61
        return this.pitch;
62
    }
63
64
    public void setPitch(float pitch) {
65
        this.pitch = pitch;
66
    }
67
68
    public boolean getGroundState() {
69
        return this.ground;
70
    }
71
72
    public void setGround(boolean ground) {
73
        this.ground = ground;
74
    }
75
76
    public boolean isPre() {
77
        return this.pre;
78
    }
79
80
    public boolean isPost() {
81
        return !this.pre;
82
    }
83
84
}

What this file does

UpdateEvent is the carrier the spin travels on. The argument constructor captures position, yaw, pitch and ground state with pre = true, and the C03 send path in EntityPlayerSP.func_175161_p reads those fields back through getYaw and getPitch after the bus fires, so a mutation made in a pre handler rewrites the packet the server receives. The no-arg constructor produces the post event with pre = false, which is the phase where modules react to the tick after the send.

The event also carries x, y, z and the ground flag with setters, which is how movement modules rewrite position on the same bus. For Derp only the yaw setter matters, and the pre/post split is what lets the handler check event.isPre() to mutate before the send.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat PacketAnalysisAimStep (frozen-axis stepping)

PacketAnalysisAimStep.java59 lines · Java
1
package de.photon.anticheataddition.modules.checks.packetanalysis;
2
3
import de.photon.anticheataddition.modules.ViolationModule;
4
import de.photon.anticheataddition.user.User;
5
import de.photon.anticheataddition.util.mathematics.MathUtil;
6
import de.photon.anticheataddition.util.minecraft.world.entity.EntityUtil;
7
import de.photon.anticheataddition.util.violationlevels.Flag;
8
import de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;
9
import de.photon.anticheataddition.util.violationlevels.ViolationManagement;
10
import org.bukkit.event.EventHandler;
11
import org.bukkit.event.Listener;
12
import org.bukkit.event.player.PlayerMoveEvent;
13
14
public final class PacketAnalysisAimStep extends ViolationModule implements Listener
15
{
16
    public static final PacketAnalysisAimStep INSTANCE = new PacketAnalysisAimStep();
17
    private static final double NO_MOVE_DELTA_THRESHOLD = 0.00001D;
18
    private static final double STEP_MOVE_DELTA_THRESHOLD = 1D;
19
20
    private PacketAnalysisAimStep()
21
    {
22
        super("PacketAnalysis.parts.AimStep");
23
    }
24
25
    @EventHandler(ignoreCancelled = true)
26
    public void onMove(PlayerMoveEvent event)
27
    {
28
        final var user = User.getUser(event.getPlayer());
29
        if (User.isUserInvalid(user, this)
30
            || event.getTo() == null
31
            || user.getPlayer().isInsideVehicle()
32
            // Not flying (vanilla or elytra) as it may trigger some fps
33
            || user.getPlayer().isFlying()
34
            || EntityUtil.INSTANCE.isFlyingWithElytra(user.getPlayer())) return;
35
36
        final double yawDelta = MathUtil.yawDistance(event.getTo().getYaw(), event.getFrom().getYaw());
37
        final double pitchDelta = MathUtil.absDiff(event.getTo().getPitch(), event.getFrom().getPitch());
38
39
        // False positives as the pitch is capped if a player looks straight up or down.
40
        if (pitchDelta < NO_MOVE_DELTA_THRESHOLD && (event.getTo().getPitch() == 90 || event.getTo().getPitch() == -90)) return;
41
42
        if (user.getData().counter.packetAnalysisAimStepFails.conditionallyIncDec(isAimStep(yawDelta, pitchDelta) || isAimStep(pitchDelta, yawDelta))) {
43
            getManagement().flag(Flag.of(user).setAddedVl(20).setDebug(() -> "PacketAnalysisData-Debug | Player: " + user.getPlayer().getName() + " sent step-like aim movements (d_yaw: " + yawDelta + ", d_pitch: " + pitchDelta + ")"));
44
        }
45
    }
46
47
    private static boolean isAimStep(double deltaOne, double deltaTwo)
48
    {
49
        return deltaOne < NO_MOVE_DELTA_THRESHOLD && deltaTwo > STEP_MOVE_DELTA_THRESHOLD;
50
    }
51
52
    @Override
53
    protected ViolationManagement createViolationManagement()
54
    {
55
        return ViolationLevelManagement.builder(this)
56
                                       .emptyThresholdManagement()
57
                                       .withDecay(200, 2).build();
58
    }
59
}

How it counteracts this module

Photon's AimStep listens on PlayerMoveEvent and computes yawDelta via MathUtil.yawDistance (the shortest angular distance, normalized) and pitchDelta as the absolute difference (lines 36-37). The step signature is one axis frozen while the other moves more than 1 degree: isAimStep returns true when deltaOne is under 0.00001 and deltaTwo exceeds 1 (lines 47-50), and the check fires when either axis order matches (line 42), adding 20 VL per flag with a 200ms decay.

The derp's pitch delta is exactly 0, safely under the frozen threshold, and the yaw delta is exactly 22, far over the step threshold, so the check flags on every move of the spin; on the wrap tick the shortest-distance yaw delta is 4 degrees, still over the threshold, so the wrap does not hide it either. This is the hardest counter in the set: the spin is a textbook frozen-axis step pattern. The commented-out pitch spoof in the module is exactly the change that would have defeated the check, because rotating pitch too breaks the frozen-axis signature.

anticheat PacketAnalysisPerfectRotation (integer-multiple deltas)

PacketAnalysisPerfectRotation.java108 lines · Java
1
package de.photon.anticheataddition.modules.checks.packetanalysis;
2
3
import de.photon.anticheataddition.modules.ViolationModule;
4
import de.photon.anticheataddition.user.User;
5
import de.photon.anticheataddition.user.data.ViolationCounter;
6
import de.photon.anticheataddition.util.mathematics.MathUtil;
7
import de.photon.anticheataddition.util.violationlevels.Flag;
8
import de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;
9
import de.photon.anticheataddition.util.violationlevels.ViolationManagement;
10
import org.bukkit.event.EventHandler;
11
import org.bukkit.event.Listener;
12
import org.bukkit.event.player.PlayerMoveEvent;
13
14
/**
15
 * Checks for suspicious packet rotation patterns that correspond to precise values like 0.25 or 0.1.
16
 */
17
public final class PacketAnalysisPerfectRotation extends ViolationModule implements Listener
18
{
19
    public static final PacketAnalysisPerfectRotation INSTANCE = new PacketAnalysisPerfectRotation();
20
21
    private PacketAnalysisPerfectRotation()
22
    {
23
        super("PacketAnalysis.parts.PerfectRotation");
24
    }
25
26
    private static final double EQUALITY_EPSILON = 0.0000000001;
27
    private static final double[] MULTIPLE_PATTERNS = {0.1, 0.25};
28
29
    private static boolean isNearlyEqual(double reference, double d)
30
    {
31
        return MathUtil.absDiff(reference, d) <= EQUALITY_EPSILON;
32
    }
33
34
    /**
35
     * Checks if the second value is an integer multiple of the first.
36
     *
37
     * @param reference The reference value.
38
     * @param d         The value to check.
39
     *
40
     * @return True if d is an integer multiple of reference, false otherwise.
41
     */
42
    private static boolean isIntegerMultiple(double reference, double d)
43
    {
44
        final double potentialMultiple = d / reference;
45
        return isNearlyEqual(potentialMultiple, Math.rint(potentialMultiple));
46
    }
47
48
    /**
49
     * Checks if the provided rotation value represents no change in rotation.
50
     * No rotation is defined as any rotation by 0 degrees or a multiple of 360 degrees.
51
     *
52
     * @param rotation The rotation value.
53
     *
54
     * @return True if there's no rotation, false otherwise.
55
     */
56
    private static boolean noRotation(double rotation)
57
    {
58
        // 0 degrees or full circles (multiple of 360 degrees)
59
        return isNearlyEqual(0, rotation) || isIntegerMultiple(360, rotation);
60
    }
61
62
    /**
63
     * Checks the pattern of rotation changes and flags suspicious rotations.
64
     *
65
     * @param user         The user under check.
66
     * @param rotationDiff The rotation difference.
67
     * @param counter      The violation counter.
68
     */
69
    private void checkPatterns(User user, double rotationDiff, ViolationCounter counter)
70
    {
71
        // Ignore 0 and 360 degrees as they represent no change in rotation.
72
        if (noRotation(rotationDiff)) return;
73
74
        // Check if the angle change is valid (not infinite or NaN).
75
        if (Double.isInfinite(rotationDiff) || Double.isNaN(rotationDiff))
76
            getManagement().flag(Flag.of(user).setAddedVl(5).setDebug(() -> "PacketAnalysisData-Debug | Player: " + user.getPlayer().getName() + " sent infinite rotation diffs."));
77
78
        for (double pattern : MULTIPLE_PATTERNS) {
79
            // Normal players sometimes have a multiple, but not consistently -> counter.
80
            if (counter.conditionallyIncDec(isIntegerMultiple(pattern, rotationDiff))) {
81
                getManagement().flag(Flag.of(user).setAddedVl(3).setDebug(() -> "PacketAnalysisData-Debug | Player: " + user.getPlayer().getName() + " sent suspicious rotation diff (" + rotationDiff + ")."));
82
            }
83
        }
84
    }
85
86
    @EventHandler(ignoreCancelled = true)
87
    public void onPlayerMove(PlayerMoveEvent event)
88
    {
89
        final var user = User.getUser(event.getPlayer());
90
        // Ignore invalid users and players in vehicles (boat false positive).
91
        if (User.isUserInvalid(user, this) || event.getTo() == null || user.getPlayer().isInsideVehicle()) return;
92
93
        final double yawDiff = MathUtil.yawDistance(event.getTo().getYaw(), event.getFrom().getYaw());
94
        final double pitchDiff = MathUtil.absDiff(event.getTo().getPitch(), event.getFrom().getPitch());
95
96
        checkPatterns(user, yawDiff, user.getData().counter.packetAnalysisPerfectRotationYawFails);
97
        checkPatterns(user, pitchDiff, user.getData().counter.packetAnalysisPerfectRotationPitchFails);
98
    }
99
100
101
    @Override
102
    protected ViolationManagement createViolationManagement()
103
    {
104
        return ViolationLevelManagement.builder(this)
105
                                       .emptyThresholdManagement()
106
                                       .withDecay(100, 2).build();
107
    }
108
}

How it counteracts this module

Photon's PerfectRotation flags rotation deltas that are exact integer multiples of 0.1 or 0.25 degrees (MULTIPLE_PATTERNS, lines 27, 78-83), using an epsilon of 1e-10 and a conditionallyIncDec counter so an occasional match decays instead of flagging. Normal mouse input almost never produces exact multiples repeatedly, which is why the consistency requirement exists.

The derp's yaw delta is exactly 22.0 every tick (22 / 0.1 is 220 and 22 / 0.25 is 88, both exact integers) and the wrap delta is exactly 4.0 (40 and 16), so the counter increments every tick and flags. The module's use of a plain float decrement is what makes the deltas exact; any jitter in the step size would break the multiples and defeat this check, so a derp variant that adds noise to the decrement would bypass it.

anticheat AimbotHeuristic (wrap discontinuity while clicking)

AimbotHeuristic.java164 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.movement.look;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.CustomCheck;
23
import me.islandscout.hawk.check.Cancelless;
24
import me.islandscout.hawk.event.*;
25
import me.islandscout.hawk.util.Debug;
26
import me.islandscout.hawk.util.MathPlus;
27
import org.bukkit.entity.Player;
28
import org.bukkit.util.Vector;
29
30
import java.util.*;
31
32
/**
33
 * AimbotHeuristic exploits flaws in aim-bot cheats by
34
 * analyzing mouse movement patterns during interaction. Although
35
 * easily bypassed, it catches a significant number of cheaters.
36
 * Caution is advised since this check may false flag during
37
 * certain circumstances. This check should only be used as a
38
 * hint that the player might be cheating.
39
 */
40
public class AimbotHeuristic extends CustomCheck implements Cancelless {
41
42
    private final Map<UUID, List<Vector>> mouseMoves;
43
    private final Map<UUID, List<Long>> clickTimes;
44
45
    private static final int MOVES_PER_SAMPLE = 4; //must be greater than 0
46
    private final int MOVES_AFTER_HIT;
47
    private final boolean DEBUG;
48
49
    public AimbotHeuristic() {
50
        super("aimbotheuristic", false, -1, 5, 0.99, 5000, "&7%player% failed aimbot (heuristic), VL %vl%", null);
51
        mouseMoves = new HashMap<>();
52
        clickTimes = new HashMap<>();
53
54
        MOVES_AFTER_HIT = MOVES_PER_SAMPLE - MOVES_PER_SAMPLE / 2;
55
56
        DEBUG = (boolean) customSetting("debug", "", false);
57
    }
58
59
    public void check(Event e) {
60
        if (e instanceof MoveEvent) {
61
            processMove((MoveEvent) e);
62
        } else if (e instanceof InteractEntityEvent || e instanceof InteractWorldEvent) {
63
            processClick(e);
64
        }
65
    }
66
67
    private void processMove(MoveEvent e) {
68
        Player p = e.getPlayer();
69
        HawkPlayer pp = e.getHawkPlayer();
70
        UUID uuid = p.getUniqueId();
71
72
        List<Vector> lastMoves = mouseMoves.getOrDefault(uuid, new ArrayList<>());
73
        Vector mouseMove = new Vector(e.getTo().getYaw() - e.getFrom().getYaw(), e.getTo().getPitch() - e.getFrom().getPitch(), 0);
74
75
        lastMoves.add(mouseMove);
76
        //make size 1 bigger so that we can get the move before
77
        //the first move that we check
78
        if(lastMoves.size() > MOVES_PER_SAMPLE + 1) {
79
            lastMoves.remove(0);
80
        }
81
        mouseMoves.put(uuid, lastMoves);
82
83
        if(clickedXMovesBefore(MOVES_AFTER_HIT, pp)) {
84
            double minSpeed = Double.MAX_VALUE;
85
            double maxSpeed = 0D;
86
            double maxAngle = 0D;
87
            for(int i = 1; i < lastMoves.size(); i++) {
88
                Vector lastMouseMove = lastMoves.get(i - 1);
89
                Vector currMouseMove = lastMoves.get(i);
90
                double speed = currMouseMove.length();
91
                double lastSpeed = lastMouseMove.length();
92
                double angle = (lastSpeed != 0 && lastSpeed != 0) ? MathPlus.angle(lastMouseMove, currMouseMove) : 0D;
93
                if(Double.isNaN(angle))
94
                    angle = 0D;
95
                maxSpeed = Math.max(speed, maxSpeed);
96
                minSpeed = Math.min(speed, minSpeed);
97
                maxAngle = Math.max(angle, maxAngle);
98
99
                //stutter
100
                if(maxSpeed - minSpeed > 4 && minSpeed < 0.01 && maxAngle < 0.1 && lastSpeed > 1) { //this lastSpeed check eliminates a false positive
101
                    if(DEBUG) {
102
                        p.sendMessage("AimbotHeuristic: A");
103
                    }
104
                    punishEm(pp, e);
105
                }
106
                //twitching or zig zags
107
                else if(speed > 20 && lastSpeed > 20 && angle > 2.86) {
108
                    if(DEBUG) {
109
                        p.sendMessage("AimbotHeuristic: B");
110
                    }
111
                    punishEm(pp, e);
112
                }
113
                //jump discontinuity
114
                else if(speed - lastSpeed < -30 && angle > 0.8) {
115
                    if(DEBUG) {
116
                        p.sendMessage("AimbotHeuristic: C");
117
                    }
118
                    punishEm(pp, e);
119
                }
120
                else {
121
                    reward(pp);
122
                }
123
            }
124
        }
125
    }
126
127
    private boolean clickedXMovesBefore(long x, HawkPlayer pp) {
128
        List<Long> clickTimess = clickTimes.getOrDefault(pp.getUuid(), new ArrayList<>());
129
        long time = pp.getCurrentTick() - x;
130
        for(int i = 0; i < clickTimess.size(); i++) {
131
            if(time == clickTimess.get(i)) {
132
                clickTimess.remove(i);
133
                return true;
134
            }
135
        }
136
        return false;
137
    }
138
139
    private void processClick(Event e) {
140
        UUID uuid = e.getPlayer().getUniqueId();
141
        List<Long> clickTimess = clickTimes.getOrDefault(uuid, new ArrayList<>());
142
        long currTick = e.getHawkPlayer().getCurrentTick();
143
        if(!clickTimess.contains(currTick))
144
            clickTimess.add(e.getHawkPlayer().getCurrentTick());
145
146
        //memory leak fail-safe, if necessary?
147
        for(int i = clickTimess.size() - 1; i >= 0; i--) {
148
            if(currTick - clickTimess.get(i) > MOVES_PER_SAMPLE + 1)
149
                clickTimess.remove(i);
150
        }
151
152
        clickTimes.put(uuid, clickTimess);
153
    }
154
155
    private void punishEm(HawkPlayer pp, MoveEvent e) {
156
        punish(pp, false, e);
157
    }
158
159
    @Override
160
    public void removeData(Player p) {
161
        mouseMoves.remove(p.getUniqueId());
162
        clickTimes.remove(p.getUniqueId());
163
    }
164
}

How it counteracts this module

Hawk's heuristic samples the last four to five raw yaw and pitch deltas, computed as a plain subtraction without shortest-distance wrapping (line 73), and evaluates them only when a click or world interaction happened within the last two moves (clickedXMovesBefore, lines 83, 127-137). The twitching and zig-zag branch flags when both the current and previous speeds exceed 20 degrees and the angle between the move vectors exceeds 2.86 radians (line 107).

The derp's normal ticks are invisible to it: speed 22 with an angle of 0 matches none of the three branches. The wrap tick is not: the raw delta from -176 to 180 is +356 degrees with the previous delta at -22, the angle between them is pi radians, and both speeds exceed 20, so the twitch branch fires. That happens once per revolution, every 16 to 17 ticks, and only while the player is clicking or swinging, which is exactly the derp-plus-killaura combination. A pure spin with no clicks never trips it, and the check's own comment warns it is a hint check with false-positive potential, so a single wrap flag is weak; sustained spinning with combat accumulates.

anticheat RotationSnapHeuristic (snap signature, spin miss)

RotationSnapHeuristic.java351 lines · Java
1
/*
2
 * Copyright 2026 Intave
3
 *
4
 * This software is licensed under the PolyForm Perimeter License 1.0.0.
5
 * You may use this software for any purpose, except for providing to
6
 * others any product that competes with the software.
7
 *
8
 * A copy of the license is available at:
9
 *   https://polyformproject.org/licenses/perimeter/1.0.0/
10
 */
11
12
package de.jpx3.intave.check.combat.heuristics.combatpatterns.rotation;
13
14
import com.comphenix.protocol.events.PacketEvent;
15
import de.jpx3.intave.check.combat.Heuristics;
16
import de.jpx3.intave.check.combat.heuristics.ClassicHeuristic;
17
import de.jpx3.intave.check.combat.heuristics.HeuristicsClassicType;
18
import de.jpx3.intave.math.MathHelper;
19
import de.jpx3.intave.module.linker.bukkit.BukkitEventSubscription;
20
import de.jpx3.intave.module.linker.packet.ListenerPriority;
21
import de.jpx3.intave.module.linker.packet.PacketSubscription;
22
import de.jpx3.intave.module.tracker.entity.Entity;
23
import de.jpx3.intave.packet.reader.EntityUseReader;
24
import de.jpx3.intave.share.BoundingBox;
25
import de.jpx3.intave.share.ClientMath;
26
import de.jpx3.intave.user.User;
27
import de.jpx3.intave.user.meta.AttackMetadata;
28
import de.jpx3.intave.user.meta.CheckCustomMetadata;
29
import de.jpx3.intave.user.meta.MovementMetadata;
30
import de.jpx3.intave.world.raytrace.EntityRaytraceBlockConstraint;
31
import de.jpx3.intave.world.raytrace.Raytrace;
32
import de.jpx3.intave.world.raytrace.Raytracing;
33
import org.bukkit.entity.Player;
34
import org.bukkit.event.block.BlockPlaceEvent;
35
36
import java.util.concurrent.atomic.AtomicLong;
37
38
import static de.jpx3.intave.check.movement.physics.environment.MoveMetric.TELEPORT;
39
import static de.jpx3.intave.module.linker.packet.PacketId.Client.*;
40
41
public final class RotationSnapHeuristic extends ClassicHeuristic<RotationSnapHeuristic.RotationSnapHeuristicMeta> {
42
  // Defines how long after a block place, arm swing or attack the VL for mitigations should be increased. 
43
  private static final long VL_BOOST_MODIFIER_TIME = (1000 / 20) * 3; // Set to 3 ticks. (150ms)
44
45
  public RotationSnapHeuristic(Heuristics parentCheck) {
46
    super(parentCheck, HeuristicsClassicType.ROTATION_SNAP, RotationSnapHeuristicMeta.class);
47
  }
48
49
  @PacketSubscription(
50
    priority = ListenerPriority.HIGH,
51
    packetsIn = {
52
      ARM_ANIMATION
53
    }
54
  )
55
  public void receiveSwingPacket(PacketEvent event) {
56
    Player player = event.getPlayer();
57
    User user = userOf(player);
58
    RotationSnapHeuristicMeta meta = metaOf(user);
59
60
    meta.lastSwing = System.currentTimeMillis();
61
  }
62
63
  @BukkitEventSubscription
64
  public void on(BlockPlaceEvent place) {
65
    Player player = place.getPlayer();
66
    User user = userOf(player);
67
    RotationSnapHeuristicMeta meta = metaOf(user);
68
    meta.lastBlockPlace.set(System.currentTimeMillis());
69
  }
70
71
  @PacketSubscription(
72
    priority = ListenerPriority.HIGH,
73
    packetsIn = {
74
      ATTACK_ENTITY, USE_ENTITY
75
    }
76
  )
77
  public void receiveAttackPacket(
78
    User user, EntityUseReader reader
79
  ) {
80
    if (reader.isAttackPacket()) {
81
      metaOf(user).lastAttack = System.currentTimeMillis();
82
    }
83
  }
84
85
  @PacketSubscription(
86
    priority = ListenerPriority.HIGH,
87
    packetsIn = {
88
      POSITION_LOOK, LOOK
89
    }
90
  )
91
  public void receiveRotationPacket(PacketEvent event) {
92
    metaOf(userOf(event.getPlayer())).rotationPacketCounter++;
93
  }
94
95
  private double keysToRotation(int strafe, int forward) {
96
    return Math.toDegrees(Math.atan2(strafe, forward)) - 90;
97
  }
98
99
  static double computeYawMotion(float lastRotationYaw, float rotationYaw) {
100
    return Math.abs(lastRotationYaw - rotationYaw);
101
  }
102
103
  static boolean isRotationSnapDetected(
104
    double previousYawMotion, double lastYawMotion, double currentYawMotion,
105
    boolean recentSwingOrAttack, int rotationPacketCounter, int ticksPastTeleport
106
  ) {
107
    boolean isSuspicious = previousYawMotion < 9 && lastYawMotion > 40 && currentYawMotion < 9;
108
    return isSuspicious && recentSwingOrAttack && rotationPacketCounter > 10 && ticksPastTeleport > 7;
109
  }
110
111
  private double floorModDouble(double x, double y) {
112
    return (x - Math.floor(x / y) * y);
113
  }
114
115
  @PacketSubscription(
116
    priority = ListenerPriority.HIGH,
117
    packetsIn = {
118
      FLYING, LOOK, POSITION, POSITION_LOOK
119
    }
120
  )
121
  public void receiveMovementPacket(PacketEvent event) {
122
    Player player = event.getPlayer();
123
    User user = userOf(player);
124
    MovementMetadata movementData = user.meta().movement();
125
126
    if (movementData.ticksPast(TELEPORT) == 0) {
127
      return;
128
    }
129
    RotationSnapHeuristicMeta meta = metaOf(user);
130
131
    if (movementData.offsetMotionX() != 0 && movementData.offsetMotionZ() != 0) {
132
      meta.internalViolation -= 0.01f;
133
      if (meta.internalViolation < 0)
134
        meta.internalViolation = 0;
135
    }
136
137
    double yawMotion = computeYawMotion(movementData.lastRotationYaw, movementData.rotationYaw);
138
    AttackMetadata attackData = user.meta().attack();
139
140
    if ((yawMotion > 40 && meta.yawMotions[1] < 9) || (yawMotion > 25 && meta.yawMotions[1] == 0)) {
141
      if (meta.lastKeyStrafe != movementData.keyStrafe || meta.lastKeyForward != movementData.keyForward) {
142
        double directionLast = movementData.rotationYaw + keysToRotation(meta.lastKeyStrafe, meta.lastKeyForward);
143
        double direction = movementData.lastRotationYaw + keysToRotation(movementData.keyStrafe, movementData.keyForward);
144
145
        direction = floorModDouble(direction, 360);
146
        directionLast = floorModDouble(directionLast, 360);
147
148
//      String key = resolveKeysFromInput(movementData.keyForward, movementData.keyStrafe);
149
//      String lastKey = resolveKeysFromInput(meta.lastKeyForward, meta.lastKeyStrafe);
150
        boolean silentMovement = (int) (ClientMath.wrapAngleTo180_double(directionLast - direction) / 45d) == 0;
151
        if (movementData.keyForward != meta.lastKeyForward || movementData.keyStrafe != meta.lastKeyStrafe) {
152
          if (silentMovement && (movementData.keyForward != 0 || movementData.keyStrafe != 0) && (meta.lastKeyForward != 0 || meta.lastKeyStrafe != 0)) {
153
            meta.silentMovements[0] = KeyStates.SILENTMOVE;
154
          } else {
155
            meta.silentMovements[0] = KeyStates.CHANGED;
156
          }
157
        }
158
      }
159
160
      Tick tick = new Tick(
161
        meta.lastLastPosX, meta.lastLastPosY, meta.lastLastPosZ,
162
        movementData.lastRotationYaw, movementData.lastRotationPitch
163
      );
164
      meta.movementAtTick[0] = tick;
165
    }
166
167
    boolean isSuspicious = (meta.yawMotions[1] == 0 && meta.yawMotions[0] > 25 && yawMotion < 9);
168
    boolean liteFlag = isSuspicious && meta.silentMovements[1] == KeyStates.SILENTMOVE && meta.rotationPacketCounter > 10 && movementData.ticksPast(TELEPORT) > 7;
169
170
    boolean snapDetected = isRotationSnapDetected(
171
      meta.yawMotions[1], meta.yawMotions[0], yawMotion,
172
      wasRecent(meta.lastSwing) || wasRecent(meta.lastAttack),
173
      meta.rotationPacketCounter,
174
      movementData.ticksPast(TELEPORT)
175
    );
176
177
    if (snapDetected) {
178
      double valueOfSnap = meta.yawMotions[0];
179
      String details = "yaw: ["
180
        + MathHelper.formatDouble(meta.yawMotions[1], 2)
181
        + "/" + MathHelper.formatDouble(meta.yawMotions[0], 2)
182
        + "/" + MathHelper.formatDouble(yawMotion, 2) + "]";
183
184
      if (meta.silentMovements[1] == KeyStates.SILENTMOVE) {
185
        details += ", movement: silent";
186
      } else if (meta.silentMovements[1] == KeyStates.CHANGED) {
187
        details += ", movement: changed";
188
      }
189
190
      boolean changedLookToEntity = false;
191
      if (attackData.lastAttackedEntity() != null && attackData.lastAttackedEntity().positionHistory.size() > 2) {
192
        Entity entity = attackData.lastAttackedEntity();
193
194
        Tick tick = meta.movementAtTick[1];
195
        Entity.EntityPositionContext lastEntityPosition = entity.lastPosition;
196
197
        if (lastEntityPosition != null && tick != null) {
198
          BoundingBox lastBoundingBox = Entity.entityBoundingBoxFrom(lastEntityPosition, entity);
199
          Raytrace last = Raytracing.entityRaytrace(
200
            player,
201
            lastBoundingBox,
202
            0,
203
            tick.posX, tick.posY, tick.posZ,
204
            tick.yaw, tick.pitch,
205
            0.1f,
206
            EntityRaytraceBlockConstraint.IGNORE_BLOCKS
207
          );
208
209
          Raytrace raytrace = Raytracing.entityRaytrace(
210
            player,
211
            entity.boundingBox(),
212
            0,
213
            movementData.lastPositionX, movementData.lastPositionY, movementData.lastPositionZ,
214
            movementData.lastRotationYaw, movementData.lastRotationPitch,
215
            0.1f,
216
            EntityRaytraceBlockConstraint.IGNORE_BLOCKS
217
          );
218
219
          changedLookToEntity = (last.reach() != 10) != (raytrace.reach() != 10);
220
          if (changedLookToEntity) {
221
            details += ", look changed to entity";
222
          }
223
        }
224
      }
225
226
      double vl = calculateViolation(valueOfSnap, changedLookToEntity, user, liteFlag);
227
      liteFlag = false;
228
229
      handleConfidence(user, (int) vl, "rotation snapped suspiciously", details);
230
    }
231
232
    if (liteFlag) {
233
      String details = "yaw: " + MathHelper.formatDouble(meta.yawMotions[0], 2);
234
      int addedViolationLevel = 30;
235
      handleConfidence(user, addedViolationLevel, "rotation snapped suspiciously while scaffolding", details);
236
    }
237
238
    prepareNextTick(meta, yawMotion, user);
239
  }
240
241
  private void handleConfidence(User user, int violationToAdd, String message, String details) {
242
    RotationSnapHeuristicMeta meta = metaOf(user);
243
244
    meta.internalViolation += violationToAdd;
245
246
    if (meta.internalViolation >= 30) {
247
      meta.internalViolation -= 30;
248
249
      if (user.protocolVersion() > 47) {
250
        details += ", protocol: " + user.protocolVersion();
251
      }
252
253
      flag(user, message, details);
254
    } else if (meta.internalViolation > 5) {
255
      // flag(user, message, details + ", debug");
256
    }
257
  }
258
259
  private double calculateViolation(double valueOfSnap, boolean changedLookToEntity, User user, boolean liteFlag) {
260
    RotationSnapHeuristicMeta meta = metaOf(user);
261
    double vl = 7;
262
    if (valueOfSnap > 360) {
263
      vl = 120;
264
    } else if (valueOfSnap > 178) {
265
      vl = 50;
266
    } else if (valueOfSnap > 90) {
267
      vl = 20;
268
    } else if (valueOfSnap > 50) {
269
      vl = 10;
270
    }
271
    if (wasRecent(meta.lastBlockPlace.get())) {
272
      vl *= 1.5;
273
    }
274
    if (changedLookToEntity) {
275
      vl *= 2;
276
    }
277
    if (meta.silentMovements[1] == KeyStates.SILENTMOVE) {
278
      vl *= 3;
279
    } else if (meta.silentMovements[1] == KeyStates.CHANGED) {
280
      vl *= 1.7;
281
    }
282
    if (liteFlag) {
283
      vl += 10;
284
    }
285
    // added the division because there are false flaggs when a player has less than 20 fps
286
    vl /= 3;
287
    if (vl > 160 && valueOfSnap < 360) {
288
      vl = 160;
289
    }
290
    return vl;
291
  }
292
293
  private boolean wasRecent(long milliseconds) {
294
    return System.currentTimeMillis() - milliseconds < VL_BOOST_MODIFIER_TIME;
295
  }
296
297
  private void prepareNextTick(RotationSnapHeuristicMeta meta, double yawMotion, User user) {
298
    MovementMetadata movementData = user.meta().movement();
299
    meta.lastKeyForward = movementData.keyForward;
300
    meta.lastKeyStrafe = movementData.keyStrafe;
301
302
    meta.lastLastPosX = movementData.lastPositionX;
303
    meta.lastLastPosY = movementData.lastPositionY;
304
    meta.lastLastPosZ = movementData.lastPositionZ;
305
306
    meta.yawMotions[1] = meta.yawMotions[0];
307
    meta.yawMotions[0] = yawMotion;
308
309
    meta.silentMovements[1] = meta.silentMovements[0];
310
    meta.silentMovements[0] = KeyStates.NONE;
311
312
    meta.movementAtTick[1] = meta.movementAtTick[0];
313
    meta.movementAtTick[0] = null;
314
  }
315
316
  enum KeyStates {
317
    NONE, CHANGED, SILENTMOVE
318
  }
319
320
  public static final class RotationSnapHeuristicMeta extends CheckCustomMetadata {
321
    //    Map<Integer, Po> entityPositions = new HashMap<>();
322
    private final Tick[] movementAtTick = new Tick[2];
323
    private final double[] yawMotions = new double[2];
324
    private final KeyStates[] silentMovements = new KeyStates[2];
325
    double lastLastPosX, lastLastPosY, lastLastPosZ;
326
    private float internalViolation;
327
    private int lastKeyForward;
328
    private int lastKeyStrafe;
329
    // used to disable the check on startup
330
    private int rotationPacketCounter;
331
    private long lastSwing;
332
    private long lastAttack;
333
334
    // AtomicLong is being used because it gets set in a Bukkit thread.
335
    private AtomicLong lastBlockPlace = new AtomicLong();
336
  }
337
338
  static class Tick {
339
    double posX, posY, posZ;
340
    float yaw, pitch;
341
342
    public Tick(double posX, double posY, double posZ, float yaw, float pitch) {
343
      this.posX = posX;
344
      this.posY = posY;
345
      this.posZ = posZ;
346
347
      this.yaw = yaw;
348
      this.pitch = pitch;
349
    }
350
  }
351
}

How it counteracts this module

intave's snap heuristic subscribes to ARM_ANIMATION (the C0A packet, which is why the check is mined under the animation corpus), ATTACK_ENTITY and USE_ENTITY, POSITION_LOOK and LOOK, and FLYING (lines 49-93). The snap signature is a single-tick yaw jump between two near-static rotations: previousYawMotion under 9 degrees, the jump over 40, and the following motion under 9, gated on a swing or attack within 150ms, more than 10 rotation packets, and more than 7 ticks since a teleport (lines 103-109, 167-175). A second lite path flags silent movement with key-input changes (lines 150-158, 167-168, 232-236).

The uniform spin defeats it on both gates. The motion triple is constant 22 degrees per tick, and even at the wrap it is [22, 356, 22], where the 22s fail the under-9 thresholds, so the snap signature never matches. The combat gate is closed anyway: the module never swings or attacks, so recentSwingOrAttack stays false. The lite path needs a change in the strafe or forward keys that the module does not produce. This entry documents the miss rather than a catch: intave's rotation heuristics are built for aimbot-style one-tick retargets, and a derp's uniform rotation is exactly the pattern they were not designed to see.

← Back to Analysis Hub