Spicy YawAndPitchSpoof module 2 files, 202 lines

Spicy YawAndPitchSpoof: Full Source Analysis

Spicy's YawAndPitchSpoof rewrites the look values of the client's C03 rotation packets before they are sent.

info/spicyclient/modules/player/YawAndPitchSpoof.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

Spicy's YawAndPitchSpoof rewrites the look values of the client's C03 rotation packets before they are sent. On every outgoing EventSendPacket at the BEFOREPRE phase, the handler pins the pitch of C05PacketPlayerLook and C06PacketPlayerPosLook packets to 90 (Down mode), -90 (Up mode) or 0 (Middle mode), and optionally reverses the yaw by adding 180. The spoof is gated on the client's own killaura being disabled: while Spicy's killaura is enabled the handler does nothing, so combat modules keep the real look. The second half of the module injects a fresh C05PacketPlayerLook carrying the player's true rotation directly through NetworkManager.sendPacketNoEvent whenever a C08 placement, C02 use-entity, C0A swing, C07 digging or C0E window-click packet is sent, so interactions are still aimed with the real look even while the standing stream is spoofed.

Look rewrite

The handler listens on EventSendPacket and runs at isBeforePre(), the earliest phase of Spicy's event pipeline, before the module bus reaches PRE. Only C05PacketPlayerLook and C06PacketPlayerPosLook are touched: the pitch is set to 90 for Down, -90 for Up or 0 for Middle, and the yaw to mc.thePlayer.rotationYaw plus 180 for Reversed. Bare C03 and C04 position-only packets pass untouched, so the spoof only rides the ticks where the player actually changed look. The ModeSetting strings are matched with the is() helper against the registered values, and the No Spoof option is a registered value with an empty branch, so selecting it leaves the packet as-is.

Interaction injection

The second branch watches for the interaction packet classes: C08PacketPlayerBlockPlacement, C02PacketUseEntity, C0APacketAnimation, C07PacketPlayerDigging and C0EPacketClickWindow. When any of them appears at BEFOREPRE, the module pushes a new C05PacketPlayerLook(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, mc.thePlayer.onGround) through sendQueue.getNetworkManager().sendPacketNoEvent, the fork's direct send that bypasses the event bus, so the injected packet never re-enters this handler. The effect is a look stream that alternates: spoofed pitch and yaw on normal rotation ticks, then a one-tick jump to the real look immediately before every swing, placement or attack, so server-side hit validation sees the real aiming direction at the moment it matters.

Wire fingerprint

Three signatures emerge. The pitch is frozen at an exact grid value (90, -90 or 0) on every rotation tick, so the look stream has a constant pitch delta of zero while the yaw follows the mouse. The Reversed mode flips the yaw by exactly 180 relative to the real facing, so the raw packet value jumps by about 180 between a spoofed tick and an injected real tick. And the injection itself is a one-tick snap: pitch and yaw both jump from the pinned values to the real values and back on the next spoofed tick, always within a tick or two of a swing or click. The killaura gate means the entire pattern disappears the moment Spicy's own killaura toggles on.

source YawAndPitchSpoof.java

YawAndPitchSpoof.java120 lines · JavaOriginal ↗
1
package info.spicyclient.modules.player;
2
3
import java.util.Random;
4
5
import org.lwjgl.input.Keyboard;
6
7
import info.spicyclient.SpicyClient;
8
import info.spicyclient.chatCommands.Command;
9
import info.spicyclient.events.Event;
10
import info.spicyclient.events.listeners.EventMotion;
11
import info.spicyclient.events.listeners.EventPacket;
12
import info.spicyclient.events.listeners.EventSendPacket;
13
import info.spicyclient.modules.Module;
14
import info.spicyclient.settings.BooleanSetting;
15
import info.spicyclient.settings.ModeSetting;
16
import info.spicyclient.settings.NumberSetting;
17
import net.minecraft.network.play.client.C02PacketUseEntity;
18
import net.minecraft.network.play.client.C03PacketPlayer;
19
import net.minecraft.network.play.client.C07PacketPlayerDigging;
20
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
21
import net.minecraft.network.play.client.C0APacketAnimation;
22
import net.minecraft.network.play.client.C0BPacketEntityAction;
23
import net.minecraft.network.play.client.C0CPacketInput;
24
import net.minecraft.network.play.client.C0EPacketClickWindow;
25
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
26
27
public class YawAndPitchSpoof extends Module {
28
	
29
	ModeSetting pitchMode = new ModeSetting("Pitch Mode", "Down", "Down", "Up", "Middle", "No Spoof");
30
	ModeSetting yawMode = new ModeSetting("Yaw Mode", "Forward", "Forward", "Reversed");
31
	
32
	public YawAndPitchSpoof() {
33
		super("Yaw And Pitch Spoof", Keyboard.KEY_NONE, Category.PLAYER);
34
		resetSettings();
35
	}
36
	
37
	@Override
38
	public void resetSettings() {
39
		this.settings.clear();
40
		this.addSettings(pitchMode, yawMode);
41
	}
42
	
43
	@Override
44
	public void onEnable() {
45
		
46
	}
47
	
48
	@Override
49
	public void onEvent(Event e) {
50
		
51
		if (e instanceof EventSendPacket && e.isBeforePre() && !SpicyClient.config.killaura.isEnabled()) {
52
			
53
			EventSendPacket event = (EventSendPacket) e;
54
			
55
			if (event.packet instanceof C03PacketPlayer.C05PacketPlayerLook) {
56
				
57
				C03PacketPlayer.C05PacketPlayerLook packet = (C03PacketPlayer.C05PacketPlayerLook) event.packet;
58
				
59
				if (pitchMode.is("Down")) {
60
					packet.setPitch(90);
61
				}
62
				else if (pitchMode.is("Up")) {
63
					packet.setPitch(-90);
64
				}
65
				else if (pitchMode.is("Middle")) {
66
					packet.setPitch(0);
67
				}
68
				else if (pitchMode.is("No Spoof")) {
69
					
70
				}
71
				
72
				if (yawMode.is("Forward")) {
73
					
74
				}
75
				else if (yawMode.is("Reversed")) {
76
					packet.setYaw(mc.thePlayer.rotationYaw + 180);
77
				}
78
				else if (yawMode.is("No Spoof")) {
79
					
80
				}
81
				
82
			}
83
			else if (event.packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
84
				
85
				C03PacketPlayer.C06PacketPlayerPosLook packet = (C03PacketPlayer.C06PacketPlayerPosLook) event.packet;
86
				
87
				if (pitchMode.is("Down")) {
88
					packet.setPitch(90);
89
				}
90
				else if (pitchMode.is("Up")) {
91
					packet.setPitch(-90);
92
				}
93
				else if (pitchMode.is("Middle")) {
94
					packet.setPitch(0);
95
				}
96
				else if (pitchMode.is("No Spoof")) {
97
					
98
				}
99
				
100
				if (yawMode.is("Forward")) {
101
					
102
				}
103
				else if (yawMode.is("Reversed")) {
104
					packet.setYaw(mc.thePlayer.rotationYaw + 180);
105
				}
106
				else if (yawMode.is("No Spoof")) {
107
					
108
				}
109
				
110
			}
111
			
112
			if (event.packet instanceof C08PacketPlayerBlockPlacement || event.packet instanceof C02PacketUseEntity || event.packet instanceof C0APacketAnimation || event.packet instanceof C07PacketPlayerDigging || event.packet instanceof C0EPacketClickWindow) {
113
				mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C05PacketPlayerLook(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, mc.thePlayer.onGround));
114
			}
115
			
116
		}
117
		
118
	}
119
	
120
}

What this file does

The module is two settings and one onEvent handler. The pitchMode ModeSetting registers Down, Up, Middle and No Spoof with Down as default; the yawMode registers Forward, Reversed and No Spoof with Forward as default. The handler gates on EventSendPacket, isBeforePre() and the killaura-disabled condition, then rewrites the C05 and C06 branches separately because the two packet classes carry the same fields with different serialization. The interaction branch at the bottom matches five packet classes and injects the real-look C05 through sendPacketNoEvent. The module registers under Category.PLAYER with no default keybind, and resetSettings rebuilds the two settings.

source Event.java (send-phase dispatch)

Event.java82 lines · JavaOriginal ↗
1
package info.spicyclient.events;
2
3
public class Event<T> {
4
	
5
	public boolean canceled;
6
	public EventType type;
7
	public EventDirection direction;
8
	
9
	public boolean isCanceled() {
10
		return canceled;
11
	}
12
	public void setCanceled(boolean canceled) {
13
		this.canceled = canceled;
14
	}
15
	public EventType getType() {
16
		return type;
17
	}
18
	public void setType(EventType type) {
19
		this.type = type;
20
	}
21
	public EventDirection getDirection() {
22
		return direction;
23
	}
24
	public void setDirection(EventDirection direction) {
25
		this.direction = direction;
26
	}
27
	
28
	public boolean isBeforePre() {
29
		if (type == null) {
30
			return false;
31
		}
32
		
33
		return type == EventType.BEFOREPRE;
34
		
35
	}
36
	
37
	public boolean isPre() {
38
		if (type == null) {
39
			return false;
40
		}
41
		
42
		return type == EventType.PRE;
43
		
44
	}
45
	
46
	public boolean isBeforePost() {
47
		if (type == null) {
48
			return false;
49
		}
50
		
51
		return type == EventType.BEFOREPOST;
52
		
53
	}
54
	
55
	public boolean isPost() {
56
		if (type == null) {
57
			return false;
58
		}
59
		
60
		return type == EventType.POST;
61
		
62
	}
63
	
64
	public boolean isIncoming() {
65
		if (direction == null) {
66
			return false;
67
		}
68
		
69
		return direction == EventDirection.INCOMING;
70
		
71
	}
72
	
73
	public boolean isOutgoing() {
74
		if (direction == null) {
75
			return false;
76
		}
77
		
78
		return direction == EventDirection.OUTGOING;
79
		
80
	}
81
	
82
}

What this file does

The base event class every Spicy event extends, and the carrier of the phase this module depends on. isBeforePre() returns true only when type is EventType.BEFOREPRE (lines 28-35), the earliest of the four phases; the module runs at that phase so the rewrite happens before any PRE handler and before the packet reaches the network layer. The class also carries the canceled flag and the INCOMING/OUTGOING direction used by Spicy's packet listeners. The C05PacketPlayerLook injected via sendPacketNoEvent is a packet, not an event, so it never passes through this class; the handler's own guard is the only thing that keeps the injection from being re-processed.

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. In any pitch-spoof mode the pitch delta is exactly 0 between consecutive spoofed rotation ticks (both are pinned to the same grid value) while the yaw delta follows the mouse, so every tick the player turns is a textbook frozen-axis step. The injected real-look tick breaks the pattern for that one tick (both axes move), but the surrounding ticks still trip the check, so the module cannot clear its own signature by injection.

anticheat PacketAnalysisPerfectRotation (exact-grid 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), with an epsilon of 1e-10 and a conditionallyIncDec consistency counter so an occasional match decays instead of flagging. The pinned pitch values are exactly 90.0, -90.0 and 0.0, which are 900, -900 and 0 multiples of 0.1, and in Reversed mode the jump between a spoofed yaw and the injected real yaw is exactly 180.0 when the mouse is still, which is 1800 multiples of 0.1 and 720 of 0.25. Every rotation tick carrying the pinned pitch and every interaction carrying the 180 flip increments the consistency counter, and the counter flags once the matches outpace the decay. Real mouse input almost never produces exact multiples repeatedly, which is the property the module's constant values violate.

anticheat AimbotHeuristic (raw-delta twitch 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 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 injected real-look C05 arrives immediately before the C0A or C02 that follows it, so the click gate is open exactly when the look snaps: in Reversed mode the raw yaw delta between the spoofed tick and the injected tick is about 180 degrees, and the pitch delta is the difference between the pinned 90 or -90 and the real pitch, typically 60 to 90 degrees, so both speeds exceed 20 and the angle is near pi, firing the twitch branch. The killaura gate is the honest bypass: while Spicy's own killaura is enabled the module stops spoofing entirely, and a user who never clicks never opens the check's evaluation window.

anticheat RotationSnapHeuristic (snap signature on the injection)

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, ATTACK_ENTITY and USE_ENTITY, POSITION_LOOK, 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). The injection produces exactly that shape in combat: the spoofed stream's yaw motion is near zero while the mouse is still, the injected real-look tick jumps the yaw by roughly 180 in Reversed mode and the pitch by 60 to 90, and the next spoofed tick returns to the pinned values, all within a tick of the C0A swing the gate requires. With Forward yaw mode and No Spoof pitch the flip disappears and the snap is reduced to the pitch jump only, which weakens but does not remove the signature on servers running the check.

← Back to Analysis Hub