0x12 S12PacketEntityVelocity

Sets an entity's velocity (e.g., from knockback, explosion, piston push).

Clientbound (Server → Client) · PLAY · net/minecraft/network/play/server/S12PacketEntityVelocity.java

Published 2026-06-18 · Updated 2026-10-14

entitymovementknockbackvelocity
Comprehensive 8/8

Fields

FieldTypeDescription
entityIdVarInt
motionXshortVelocity X × 8000
motionYshortVelocity Y × 8000
motionZshortVelocity Z × 8000

Wire Encoding

FieldTypeNotes
Entity IDVarInt
Velocity Xshort× 8000
Velocity Yshort× 8000
Velocity Zshort× 8000

MCP References

MCPNetHandlerPlayClient.handleEntityVelocity()

Handler Interface

HNDINetHandlerPlayClient

Notes

Velocities are encoded as (value * 8000). Real velocity = encoded / 8000.

Vanilla Source

S12PacketEntityVelocity.java114 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
9
public class S12PacketEntityVelocity implements Packet<INetHandlerPlayClient>
10
{
11
    private int entityID;
12
    private int motionX;
13
    private int motionY;
14
    private int motionZ;
15
16
    public S12PacketEntityVelocity()
17
    {
18
    }
19
20
    public S12PacketEntityVelocity(Entity entityIn)
21
    {
22
        this(entityIn.getEntityId(), entityIn.motionX, entityIn.motionY, entityIn.motionZ);
23
    }
24
25
    public S12PacketEntityVelocity(int entityIDIn, double motionXIn, double motionYIn, double motionZIn)
26
    {
27
        this.entityID = entityIDIn;
28
        double d0 = 3.9D;
29
30
        if (motionXIn < -d0)
31
        {
32
            motionXIn = -d0;
33
        }
34
35
        if (motionYIn < -d0)
36
        {
37
            motionYIn = -d0;
38
        }
39
40
        if (motionZIn < -d0)
41
        {
42
            motionZIn = -d0;
43
        }
44
45
        if (motionXIn > d0)
46
        {
47
            motionXIn = d0;
48
        }
49
50
        if (motionYIn > d0)
51
        {
52
            motionYIn = d0;
53
        }
54
55
        if (motionZIn > d0)
56
        {
57
            motionZIn = d0;
58
        }
59
60
        this.motionX = (int)(motionXIn * 8000.0D);
61
        this.motionY = (int)(motionYIn * 8000.0D);
62
        this.motionZ = (int)(motionZIn * 8000.0D);
63
    }
64
65
    /**
66
     * Reads the raw packet data from the data stream.
67
     */
68
    public void readPacketData(PacketBuffer buf) throws IOException
69
    {
70
        this.entityID = buf.readVarIntFromBuffer();
71
        this.motionX = buf.readShort();
72
        this.motionY = buf.readShort();
73
        this.motionZ = buf.readShort();
74
    }
75
76
    /**
77
     * Writes the raw packet data to the data stream.
78
     */
79
    public void writePacketData(PacketBuffer buf) throws IOException
80
    {
81
        buf.writeVarIntToBuffer(this.entityID);
82
        buf.writeShort(this.motionX);
83
        buf.writeShort(this.motionY);
84
        buf.writeShort(this.motionZ);
85
    }
86
87
    /**
88
     * Passes this Packet on to the NetHandler for processing.
89
     */
90
    public void processPacket(INetHandlerPlayClient handler)
91
    {
92
        handler.handleEntityVelocity(this);
93
    }
94
95
    public int getEntityID()
96
    {
97
        return this.entityID;
98
    }
99
100
    public int getMotionX()
101
    {
102
        return this.motionX;
103
    }
104
105
    public int getMotionY()
106
    {
107
        return this.motionY;
108
    }
109
110
    public int getMotionZ()
111
    {
112
        return this.motionZ;
113
    }
114
}

Deobfuscated MCP 1.8.9 source of S12PacketEntityVelocity, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S12PacketEntityVelocity.java) at build time and verified present.

Deep Dive

Role in the protocol

The velocity/knockback packet: entity id plus three motion shorts at x8000. The server emits it in three situations: EntityTrackerEntry broadcasts when a tracked entity's motion changes beyond a threshold (sendVelocityUpdates with lastTrackedEntityMotionX/Y/Z), EntityPlayer.attackEntityFrom sends it to the damaged player with the knockback vector, and explosions apply their push through S27. handleEntityVelocity overwrites the target entity's motion directly, which makes this the single most important clientbound packet for anti-knockback work.

Vanilla handling

EntityTrackerEntry compares the tracked entity's current motion to the last tracked values each tick and sends S12 when the delta crosses the threshold; EntityPlayer.attackEntityFrom sends the knockback vector straight to the damaged player's connection. On the client, handleEntityVelocity sets motionX/Y/Z = value / 8000.0 with no interpolation and no validation, so the packet is a direct write into the physics state that every movement check in the tick loop reads.

Why clients touch it

The most-handled clientbound packet in the corpus after S08. Four families: (1) cancel-or-scale anti-knockback (Memeware, Nekoware, Spicy, Tenacity, Rise 5.99 Custom); (2) per-anticheat timing games that cancel selectively or replay the knockback the way the anticheat expects (Rise 5.99 Vulcan/Tick Cancel/Stack/Follow First Tick/Ground, Sigma AACPush/AACFlag, the Rise 6.x ten-mode Velocity suite); (3) movement modules that consume S12 as a boost trigger (Rise 6.x GrimFlight TNT, WatchdogLongJump, WatchdogFireball, MatrixFlight, MineLandFlight, WatchdogBowLongJump; Rise 5.99 Fly Minemenclub and LongJump Hycraft/Vulcan; Sigma Fly; Tenacity FlightModule); (4) infrastructure: Rise's PingSpoofComponent buffers S12 in the velocity class, EntityTickComponent and ItemDamageComponent observe it, and Timer/Breaker/HurtCamera cancel it as collateral. November Recode 2.0's VelocityModule adds REDUCE, REVERSE, CANCEL and the per-anticheat GRIM, VULCAN, WATCHDOG and WATCHDOG_SAFE modes, with GRIM buffering S32 transactions and VULCAN cancelling the C0F echo.

Exploit surface

The server recomputes knockback from attack packets and expects the resulting motion to appear in the player's reported positions over the next ticks. Cancelling S12 desyncs those reports, which is exactly what velocity checks measure, so the arms race is about timing: Tick Cancel and Stack modes cancel the first N velocity packets and let one through to satisfy the check, Sigma's AACFlag injects a NaN position to blind the check, and WatchdogVelocity modes apply the knockback client-side exactly as the server computes it. The companion S27PacketExplosion carries its own knockback and must be handled separately, which is why every serious module pairs S12 and S27. Rise 5.99 even ships an anticheat-side velocity recorder in dev/rise/anticheat/data/PlayerData.java and a dcOnVeloCheck disconnect in AutoHypixel that reacts to velocity-based server checks.

Server-Side Handling

EntityTrackerEntry keeps lastTrackedEntityMotionX/Y/Z and sends S12 to tracked players when the entity's motion changes beyond a threshold (sendVelocityUpdates). EntityPlayer.attackEntityFrom sends S12 to the damaged player with the knockback vector from the attacker's motion. The client applies value / 8000.0 directly to motionX/Y/Z with no validation, so the packet is a trusted write into the physics state. Explosion knockback travels separately in S27 and is not covered by S12.

Protocol Analysis

VarInt entity id plus three shorts at x8000, no rotations, no metadata. Values are signed, so negative motion (pulled, pushed back) encodes naturally. The client divides by 8000.0 on apply; the short range limits motion to roughly -4.096 to 4.096 blocks/tick. Because the write is direct, packet order matters: an S12 arriving after the tick's movement code runs applies one tick late, which knockback-timing modules exploit.

Anti-Cheat Landscape

Velocity checks reconcile the knockback vector with the player's reported position over the following ticks. Cancelling S12 is instantly measurable, so modern modes instead cancel selectively (first N packets, then pass one), reverse the vector (Sigma AACPush converts it into a strafe boost), or replay the exact server motion (WatchdogVelocity). Grim and Vulcan are sensitive to delayed application, which is why Rise 6.x splits the Velocity module into per-anticheat modes (GrimVelocity, VulcanVelocity, MMCVelocity, RedeskyVelocity, UniversoCraftVelocity, WatchdogPredictionVelocity) and why Rise 5.99's own anticheat records S12 in PlayerData.java for its checks.

implementation Implementation Cases

The knockback packet: three shorts at x8000 written directly into entity motion. The most-handled clientbound packet in the 8-client corpus, spanning cancel-or-scale anti-knockback (Memeware, Nekoware, Spicy, Tenacity, Rise 5.99), per-anticheat timing suites (Sigma AAC modes, Rise 5.99 modes, the Rise 6.x ten-mode Velocity module), movement modules that use S12 as a boost trigger (GrimFlight TNT, WatchdogLongJump, WatchdogFireball, Sigma Fly), and component infrastructure (PingSpoofComponent buffers it as the velocity class).

Velocity / AntiKnockback (cancel and scale) (Memeware 7.3, Nekoware v1 private, Rise 5.99, Spicy, Tenacity 6.0, November Recode 2.0)

Remove or scale knockback by intercepting the S12 that targets the local player.

A packet-receive handler checks the entity id; if it matches the player, the packet is cancelled outright (Memeware, Nekoware, Rise 5.99 at 0% settings) or its motion fields are scaled by horizontal/vertical percentages (Spicy, Tenacity). S27PacketExplosion is cancelled or scaled in the same handler because explosion knockback bypasses S12.

Source: Memeware 7.3, me/memewaredevs/client/module/combat/Velocity.java

Vanilla hook: PacketInEvent (Memeware/Nekoware), EventPacket pre (Spicy), PacketReceiveEvent (Tenacity, Rise 5.99).
Outright cancellation is the fastest flag on any velocity-check anticheat; scaling to a nonzero percentage passes on servers that only check for complete absence of motion. Rise 5.99's Custom mode layers timer and attack-time scaling to blur the cancel.
Variations: Memeware and Nekoware are byte-for-byte the same cancel logic. Spicy scales via settings and cancels S27 always. Tenacity scales via NumberSettings and cancels both packets at 0%. Rise 5.99 adds modes (Reverse, Ground, Stack, Follow First Tick) on top of the same Custom scale. November Recode 2.0's VelocityModule is the same-role module with per-mode scaling (REDUCE, REVERSE) and anticheat-specific cancels (GRIM, VULCAN, WATCHDOG_SAFE).
AntiVelocity (Sigma AAC modes) (Sigma 4.11)

Defeat knockback with anticheat-specific tricks instead of a plain cancel.

Basic mode scales or cancels S12 and cancels S27. AACPush samples the knockback vector, cancels the packet and turns the stored motion into a decaying strafe boost over 10 ticks. AACFlag cancels the packet and injects a C04 with NaN Y while the player is in hurt time, desyncing the anticheat's position model.

Source: Sigma 4.11, info/sigmaclient/module/impl/combat/AntiVelocity.java

Vanilla hook: EventPacket (registerEvent with EventUpdate), pre stage for clientbound.
The AACFlag NaN-position injection is a hostile desync that several 1.8 anti-cheats mis-handle; it is also the most detectable pattern in the module when the server sanity-checks NaN coordinates. AACPush keeps motion nonzero, which defeats simple knockback-absence checks.
Variations: The module also guards Sigma's own BowFly: when Fly is in BowFly mode the S12 for the player is left intact so the bow-boost velocity is preserved.
Velocity / Rise 6.x suite (per-anticheat modes) (Rise 6.1.30, Rise 6.2.4)

Per-anticheat anti-knockback: ten modes in the Velocity module, each tuned to a specific server anticheat.

Each mode is a Mode subclass of the Velocity module handling PacketReceiveEvent: StandardVelocity scales/cancels and optionally copies the server's vertical motion into motionY; GrimVelocity, VulcanVelocity, MMCVelocity, RedeskyVelocity and UniversoCraftVelocity tune cancellation and replay timing per anticheat; WatchdogVelocity and WatchdogPredictionVelocity emulate the knockback the Watchdog check expects; BufferAbuseVelocity and LegitVelocity delay or minimize application. The onSwing gate skips handling unless the player is swinging, which hides the module's presence during combos.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/StandardVelocity.java

Vanilla hook: PacketReceiveEvent, PreMotionEvent, TeleportEvent; packet replaced via event.setPacket.
The suite's core trick is not cancelling but reshaping: rescale the packet and re-set it so the pipeline delivers a modified but present velocity, then let one tick of real knockback through. The commented-out Watchdog strafe logic in StandardVelocity shows the iteration history of the mode.
Variations: 6.2.4 adds WatchdogPredictionVelocity to the 6.1.30 lineup; the mode set otherwise matches (Grim, Legit, MMC, Redesky, Standard, UniversoCraft, Vulcan, Watchdog, BufferAbuse).
Flight / LongJump (movement boost) (Rise 5.99, Rise 6.1.30, Rise 6.2.4, Sigma 4.11, Tenacity 6.0)

Use the player's own S12 as a trigger or fuel for flight and longjump acceleration.

Flight and longjump modes listen for S12 targeting the player and either flip a state flag that enables teleport-style flight (GrimFlight TNT), buffer the velocity for a follow-up boost (WatchdogLongJump, WatchdogFireball), or scale it into movement acceleration (Sigma Fly, Tenacity FlightModule). The packet is deliberately not cancelled, because the anti-cheat expects the knockback motion to exist.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/flight/GrimFlight.java

Vanilla hook: PacketReceiveEvent, PreMotionEvent, TeleportEvent.
These modes are the flip side of anti-knockback: they need the S12 to arrive intact, so they must not conflict with the Velocity module, and they exploit the fact that the server cannot distinguish a knockback-boosted jump from a legitimate one when the packet was never tampered with.
Variations: Rise 5.99 uses S12 in Fly Minemenclub and LongJump Hycraft/Vulcan; Rise 6.x spreads it across GrimFlight, MatrixFlight, MineLandFlight, WatchdogFlight, WatchdogJesus, WatchdogLongJump, WatchdogBowLongJump, WatchdogFireball, NCPSpeed and WatchdogSpeed; Sigma handles it inside Fly; Tenacity inside FlightModule.
PingSpoofComponent (velocity buffer) (Rise 6.1.30, Rise 6.2.4)

Delay S12 alongside transactions and keepalives while ping spoofing, which delays knockback application as a side effect.

The component classifies packets into tuples: S12 is grouped with S27 in the velocity tuple. While a spoof is active, matching packets are cancelled from the event stream and parked in a timestamped queue; onPostMotion flushes entries whose delay elapsed via PacketUtil.queue, which bypasses the event bus. The players tuple holds S13 and the S14/S18/S19/S20 entity stream so entity ordering survives the buffering.

Source: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java

Vanilla hook: PacketSendEvent, PacketReceiveEvent, PostMotionEvent, WorldChangeEvent.
Delayed S12 is safe against velocity checks that sample a single tick (the knockback still arrives), but dangerous against checks that measure the gap between the hit and the motion, which is why the component is paired with per-anticheat Velocity modes in the same client.
Variations: Identical component in 6.1.30 and 6.2.4; 6.2.4's PingSpoof and Timer modules both drive it via the static spoof() entry points.
VelocityModule (per-anticheat modes) (November Recode 2.0)

Per-mode anti-knockback: scale, reverse or cancel S12 for the local player, with anticheat-specific transaction handling for Grim and Vulcan.

The packet listener ignores S12 whose entity id is not the local player, then switches on mode. REDUCE and REVERSE scale the motion fields in place with horizontal and vertical percentages and REVERSE negates the result; CANCEL, GRIM and VULCAN cancel the event; INTAVE and WATCHDOG are TODO stubs; WATCHDOG_SAFE cancels then re-applies only the vertical component to motionY while on the ground. GRIM mode additionally buffers S32 confirm-transaction actions and cancels the matching C0F echo on the send side; VULCAN cancels a single C0F echo after the first knockback.

Source: November Recode 2.0, feature/module/impl/combat/VelocityModule.java

Vanilla hook: EventPacket.In (S12, S32), EventPacket.Out (C0F), EventUpdate.
In-place scaling is the stealthiest path; outright cancel is the fastest flag on any velocity check. The GRIM transaction buffer exists because Grim correlates the S32/C0F gap with knockback, so the module hides both at once; the WATCHDOG_SAFE vertical re-apply keeps the server's expected motion curve while zeroing horizontal drift.
Variations: Memeware and Nekoware cancel with no modes; Rise 6.x splits per-anticheat handling across Mode subclasses of the Velocity module; November packs the modes into one class with transaction buffering built in.
PacketReceiveEvent is universal; the packet is re-set on the event in Rise (event.setPacket) and mutated or cancelled in place on classic event buses (Memeware, Nekoware, Sigma, Spicy). Rise 6.x handles it through the component system and the Velocity module's Mode classes.
Memeware/Nekoware cancel inside PacketInEvent; Spicy mutates the packet object and cancels the event; Tenacity cancels or scales via IEventListener; Rise 5.99 replaces the packet on the event; Rise 6.x re-sets it and additionally buffers it in PingSpoofComponent; Sigma mutates or cancels and injects C04 for the AACFlag mode. November Recode 2.0 cancels or mutates the packet inside EventPacket.In and additionally hooks C0F sends for the GRIM and VULCAN transaction games.

anticheat Anti-Cheat Checks

S12 is the server telling the client to apply a velocity vector, normally knockback, and every anticheat treats it as a promise: the client's next movement ticks must reflect the vector it was sent. The corpus splits into direct statistical checks (Azure VelocityA compares the vertical delta against the sent vector) and transaction-ordered simulation checks (Grim KnockbackHandler, Artemis VelocityPreProcessor, Frequency VelocityManager) that know exactly when the packet arrived at the client and require the knockback in the following prediction. This packet is the reason anti-knockback cheats cancel or alter S12 specifically.

KnockbackHandler / AntiKB (Grim) (GrimAnticheat-Grim)

Requires the client's simulated motion to include the exact knockback vector the server sent, flagging any reduction or delay.

On the OUT side, wraps each entity-velocity packet for the player (or their vehicle) between two transaction packets, recording the vector with the first transaction id. As client transactions arrive, knockbacks move from a future queue into known-taken state; the prediction engine then compares the player's actual movement against the required knockback, accumulating a threshold-bounded buffer and triggering a setback above the immediate threshold.

Detects: Anti-knockback, velocity cancel and velocity reduction cheats, including selective cancels that take partial knockback.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java

Variations: Artemis VelocityPreProcessor applies the velocity in a transaction-confirmed pre action; Grim instead leaves it in a queue until the client's transactions prove arrival.
VelocityA (Azure) (AimbotPvP-azure-anticheat)

Classic 1.8 statistical check: the reported upward move after a knockback packet must be at least 77 percent of the sent vertical velocity.

Reads the OUT entity-velocity packet, keeps the vertical component (field c divided by 8000.0) when the entity id matches the player, and skips causes that do not produce knockback (starvation, fire, drowning, poison, wither, thorns, fall, lava). On the next upward move it compares deltaY to the recorded velocity and reports the taken percentage as a violation.

Detects: Anti-knockback that reduces or zeroes vertical velocity; the percentage reported makes the flag self-documenting.

Source: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/combat/velocity/VelocityA.java

Variations: Rammelkast VelocityCheck and MIU AntiVelocity use the same sent-vector-vs-delta comparison; Grim and Artemis add transaction ordering on top.
VelocityManager feed (Frequency) (ElevatedDev-Frequency)

Records every player-targeted S12 into a short-lived velocity window that all movement checks read for exemptions and baselines.

The outgoing packet processor wraps each entity-velocity packet, and when the entity id is the player, pushes the vector into the VelocityManager. The manager keeps snapshots with horizontal and vertical magnitudes for two seconds, exposing max values that the speed and invalid checks add to their expected baselines, and the VELOCITY exemption type switches off checks while a recent velocity is active.

Detects: Anti-knockback cheats are detected by the speed and invalid checks because the expected velocity baseline is missing or reduced.

Source: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/processor/impl/OutgoingPacketProcessor.java

Variations: Azure VelocityA keeps a single vertical velocity scalar; Frequency keeps a time-windowed deque so exemptions decay naturally.
VelocityPreProcessor (Artemis) (artemisac-artemis-minecraft-anticheat)

Applies the S12 velocity to the movement holder only after the client confirms the packet, so prediction checks see it in the correct tick.

Matches the OUT entity-velocity packet for the player's entity id, builds a Velocity object, and registers it in the connection's transaction confirmation. The pre action moves the current velocity into lastVelocity and installs the new vector as processed; the post action clears the processed flag when the transaction returns.

Detects: Velocity spoofing where a client applies knockback at the wrong time or not at all, which shows up as a prediction residual.

Source: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/velocity/VelocityPreProcessor.java

Variations: Grim queues knockbacks against transaction ids; Artemis installs them in a confirmation callback, which is the same ordering idea with different storage.

Wiki Cross-Reference

PLAY id 0x12: VarInt entityId plus three signed shorts; real motion equals encoded value / 8000.0, clamped near +-3.9.

Handler writes motionX/Y/Z directly with no interpolation, so cancel-or-scale hooks are the standard anti-knockback point.

MCP 1.8.9 S12PacketEntityVelocity implements Packet dispatching to INetHandlerPlayClient.handleEntityVelocity; wire serde is readPacketData/writePacketData via readShort, readVarIntFromBuffer.

1.8.9 callers: EntityTrackerEntry.? sends new S12PacketEntityVelocity (line 238) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java

Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.

Vanilla Internals

Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.