0x04 S04PacketEntityEquipment

Updates an entity's equipped item in a specific slot (main hand, armor slots).

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

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

entityequipmentitem
Complete 6/8

Fields

FieldTypeDescription
entityIdVarIntEntity ID
slotshort0=mainHand, 1-4=armor (boots/legs/chest/helmet)
itemSlotItemStack equipped

Wire Encoding

FieldTypeNotes
Entity IDVarInt
Slotshort0=held, 1=boots, 2=legs, 3=chest, 4=helmet
ItemSlotItemStack or null

MCP References

MCPNetHandlerPlayClient.handleEntityEquipment()

Handler Interface

HNDINetHandlerPlayClient

Vanilla Source

S04PacketEntityEquipment.java68 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.item.ItemStack;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
9
public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient>
10
{
11
    private int entityID;
12
    private int equipmentSlot;
13
    private ItemStack itemStack;
14
15
    public S04PacketEntityEquipment()
16
    {
17
    }
18
19
    public S04PacketEntityEquipment(int entityIDIn, int p_i45221_2_, ItemStack itemStackIn)
20
    {
21
        this.entityID = entityIDIn;
22
        this.equipmentSlot = p_i45221_2_;
23
        this.itemStack = itemStackIn == null ? null : itemStackIn.copy();
24
    }
25
26
    /**
27
     * Reads the raw packet data from the data stream.
28
     */
29
    public void readPacketData(PacketBuffer buf) throws IOException
30
    {
31
        this.entityID = buf.readVarIntFromBuffer();
32
        this.equipmentSlot = buf.readShort();
33
        this.itemStack = buf.readItemStackFromBuffer();
34
    }
35
36
    /**
37
     * Writes the raw packet data to the data stream.
38
     */
39
    public void writePacketData(PacketBuffer buf) throws IOException
40
    {
41
        buf.writeVarIntToBuffer(this.entityID);
42
        buf.writeShort(this.equipmentSlot);
43
        buf.writeItemStackToBuffer(this.itemStack);
44
    }
45
46
    /**
47
     * Passes this Packet on to the NetHandler for processing.
48
     */
49
    public void processPacket(INetHandlerPlayClient handler)
50
    {
51
        handler.handleEntityEquipment(this);
52
    }
53
54
    public ItemStack getItemStack()
55
    {
56
        return this.itemStack;
57
    }
58
59
    public int getEntityID()
60
    {
61
        return this.entityID;
62
    }
63
64
    public int getEquipmentSlot()
65
    {
66
        return this.equipmentSlot;
67
    }
68
}

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

Deep Dive

Role in the protocol

Per-slot equipment sync for tracked entities. EntityTrackerEntry pushes it when a tracked entity's equipment changes (line ~399 in the bundled sources) and EntityLivingBase broadcasts it on item or armor updates (line ~1644). The payload is the entity id, a short slot 0-4 (0 held item, 1-4 boots/legs/chest/helmet) and a Slot-encoded ItemStack that may be null to clear. The initial burst arrives at entity spawn so the client can render held items and armor before other entity data matters.

Vanilla handling

NetHandlerPlayClient.handleEntityEquipment resolves the entity and calls setCurrentItemOrArmor(slot, item), which writes into the EntityLivingBase equipment array that the render layers read every frame. The local player is exempt: the client's own equipment never arrives as S04, it is driven by inventory and held-item packets, so this channel is strictly about other entities.

Why clients barely touch it

The corpus yields two non-vanilla references, both dead imports: Rise 5.99 Aura.java imports S04 at line 43 and never uses it in the body, and Sigma 4.11 InventoryManager.java imports it at line 30 while actually processing S09PacketHeldItemChange and S1CPacketEntityMetadata. Rise 6.1.30/6.2.4 expose it only through the script API whitelist (NetworkAPI.java line 50). No ESP, tracer, nametag or AntiBot module hooks it, because those features read the equipment array the vanilla handler already updated: intercepting the packet would duplicate state the client already owns.

Exploit surface

None in the corpus. The packet is server-authored and the client has no serverbound equipment channel to abuse. The theoretical value is weapon-switch intelligence: slot-0 S04 deltas reveal exactly when a tracked opponent swaps tools, which is timing data a combat module could use, but none of the 8 clients implements it. Anti-cheats do not police the packet because the client cannot influence it.

Server-Side Handling

The server-side senders are EntityTrackerEntry (on tracked-equipment change, line ~399) and EntityLivingBase (on item/armor updates, line ~1644). There is no serverbound counterpart: the client reports inventory changes through C09PacketHeldItemChange and C0EPacketClickWindow, and the server echoes the resulting equipment state to other trackers as S04. Nothing in the server validates the packet because it never receives it.

Protocol Analysis

Fields in order: VarInt entity id, short slot, then a Slot-encoded ItemStack (short item id + count + damage + optional NBT, with id -1 encoding null). One packet per slot, so a full armor change is five packets; the client applies them independently and a late packet can overwrite a newer value if ordering slips, which is a known quirk of the 1.8 entity-equipment path.

Anti-Cheat Landscape

No anti-cheat measures this packet: it is clientbound, server-authored and carries no timing or movement signal. The only consumer-side risk would be a module that uses slot-0 deltas to time attacks, which would inherit whatever the target's anti-cheat flags for reaction-time consistency; nothing in the corpus does this.

implementation Implementation Cases

Equipment sync for tracked entities that the vanilla handler commits straight into EntityLivingBase, which is why every armor-aware feature in the 8 clients reads the fields instead of the packet. The only non-vanilla references are two dead imports (Rise 5.99 Aura, Sigma 4.11 InventoryManager) and the Rise 6.x script whitelist; no module processes it, so the module list is empty by corpus fact, not by omission.

The only client-side deltas are the dead imports (Rise 5.99 Aura, Sigma 4.11 InventoryManager) and the Rise 6.x script API entry; everything else in all 8 clients is the untouched vanilla handler.

anticheat Anti-Cheat Checks

Server-side anticheats see S04 only on send, and the real consumers split into two groups. State mirrors keep the simulated entity copy honest: Grim reads the packet in PacketEntityReplication and applies it through CompensatedEntities on the transaction clock. Countermeasure modules rewrite the outgoing payload so other clients cannot scout gear: Photon's information hiders and Intave's EquipmentFilter. The rest of the corpus is keyword noise: Rammelkast, NCP UseItemAdapter and LightAntiCheat hit on org.bukkit.inventory.EquipmentSlot armor reads inside movement checks, Artemis and Negativity contribute wrappers and registrations, and the Peyang and MinecraftAntiCheat NPC bait code sends the packet to fake entities, which is a send-side use, not a check.

Entity equipment replication (Grim) (GrimAnticheat-Grim)

Keeps the compensated entity copy's equipment mirror in sync with the server so checks that depend on other players' gear (elytra gliding, attack range, horse saddle state) evaluate the right items at the right tick.

PacketEntityReplication reads WrapperPlayServerEntityEquipment on the ENTITY_EQUIPMENT send and schedules updateEntityEquipment as a real-time task on the transaction clock (lastTransactionSent), so the equipment change lands exactly when the client would have processed it. CompensatedEntities guards on the trackEntityEquipment flag, then folds each Equipment entry into the packet entity through setItemBySlot. PacketEntityHorse and PacketEntityNautilus enable tracking because saddle state is movement-relevant, and PacketEntityHappyGhast tracks its body slot.

Detects: Nothing directly: this is state replication. It removes equipment desync as a variable from checks that reason about what a tracked entity holds or rides.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java

Variations: The packet read lives in Grim PacketEntityReplication lines 161-162, the same transaction sandwich used for the metadata and player-info branches. No other anticheat mirrors other entities' equipment into a simulation.
Information hider (Photon) (Photon-GitHub-AntiCheatAddition)

Anti-ESP countermeasure: rewrite outgoing S04 payloads so other clients cannot infer a player's gear from durability, enchantments, lore or item counts.

InformationHiderModule registers a HIGH-priority send listener on ENTITY_EQUIPMENT, parses the wrapper, skips the player's own entity, and hands every equipped item to the abstract hideInformation hook. DurabilityHider, EnchantmentHider and ItemCountHider subclass it, and PacketInformationHider routes the ENTITY_EQUIPMENT case by entity id for the visibility system. The server still sees the real items; only the forwarded copies are stripped.

Detects: Nothing: this is a protection module, not a violation check. It defeats client-side gear scouting such as enchantment and durability ESP that a server-side anticheat cannot observe directly.

Source: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/informationhider/InformationHiderModule.java

Variations: Photon's LegacyPlayerEquipmentHider and ModernPlayerEquipmentHider replace the equipment list with empty stacks for hidden players. No other anticheat rewrites S04 payloads.
Equipment filter (Intave) (intave-intave)

The same countermeasure family as Photon: strip enchantments, display names, lore and book contents from outgoing equipment packets so clients cannot scout items.

EquipmentFilter subscribes to the ENTITY_EQUIPMENT outbound packet and rewrites the payload in place: amounts are set to 1, enchantments are removed and replaced with a single THORNS marker, book title and pages are cleared, firework effects are emptied, and display name and lore are blanked. It handles both the legacy single-item layout (1.8-1.15) and the slot-pair list layout (1.16+). The clone ships with enabled() returning false, so the filter is compiled but inactive by default.

Detects: Nothing: a defensive filter. It prevents other players' clients from reading real equipment data off the wire.

Source: intave-intave, src/main/java/de/jpx3/intave/module/filter/EquipmentFilter.java

Variations: Intave's FakePlayer equipment actions (EquipmentArmorAction, EquipmentHeldItemAction) send S04 to bait NPCs instead of filtering it. Peyang and network-dev MinecraftAntiCheat NPC code also send S04 with armor stacks to fake entities; those are bait sends, not checks.

Wiki Cross-Reference

PLAY id 0x04: VarInt entityId, short slot 0 held and 1-4 boots/legs/chest/helmet, then Slot ItemStack.

Empty slot encodes as item id -1; one packet per slot so a full armor change is up to five packets.

MCP 1.8.9 S04PacketEntityEquipment implements Packet dispatching to INetHandlerPlayClient.handleEntityEquipment; wire serde is readPacketData/writePacketData via readItemStackFromBuffer, readShort, readVarIntFromBuffer.

1.8.9 callers: EntityLivingBase.onUpdate sends new S04PacketEntityEquipment (line 1814) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityLivingBase.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.