0x2F S2FPacketSetSlot

Sets a single slot in an inventory window. Used for cursor updates, specific slot changes, and armor slot updates.

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

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

inventoryitemcontainer
Comprehensive 8/8

Fields

FieldTypeDescription
windowIdbyteWindow ID (-1 = cursor, 0 = player inv)
slotshortSlot index (-1 = cursor)
itemSlot (ItemStack)ItemStack to place in slot (null = clear)

Wire Encoding

FieldTypeNotes
Window IDbyte-1=cursor, 0=player inventory
SlotshortSlot index
Slot DataSlotItemStack or null

MCP References

MCPNetHandlerPlayClient.handleSetSlot()

Handler Interface

HNDINetHandlerPlayClient

Notes

windowId=-1 special case: updates the cursor item (the item held by the mouse cursor). windowId=0: updates player inventory. S2F is sent for EVERY slot change: armor equips, hotbar changes, cursor picks up/drops. Inventory modules track S2F to detect armor swaps and item pickups.

Vanilla Source

S2FPacketSetSlot.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 S2FPacketSetSlot implements Packet<INetHandlerPlayClient>
10
{
11
    private int windowId;
12
    private int slot;
13
    private ItemStack item;
14
15
    public S2FPacketSetSlot()
16
    {
17
    }
18
19
    public S2FPacketSetSlot(int windowIdIn, int slotIn, ItemStack itemIn)
20
    {
21
        this.windowId = windowIdIn;
22
        this.slot = slotIn;
23
        this.item = itemIn == null ? null : itemIn.copy();
24
    }
25
26
    /**
27
     * Passes this Packet on to the NetHandler for processing.
28
     */
29
    public void processPacket(INetHandlerPlayClient handler)
30
    {
31
        handler.handleSetSlot(this);
32
    }
33
34
    /**
35
     * Reads the raw packet data from the data stream.
36
     */
37
    public void readPacketData(PacketBuffer buf) throws IOException
38
    {
39
        this.windowId = buf.readByte();
40
        this.slot = buf.readShort();
41
        this.item = buf.readItemStackFromBuffer();
42
    }
43
44
    /**
45
     * Writes the raw packet data to the data stream.
46
     */
47
    public void writePacketData(PacketBuffer buf) throws IOException
48
    {
49
        buf.writeByte(this.windowId);
50
        buf.writeShort(this.slot);
51
        buf.writeItemStackToBuffer(this.item);
52
    }
53
54
    public int func_149175_c()
55
    {
56
        return this.windowId;
57
    }
58
59
    public int func_149173_d()
60
    {
61
        return this.slot;
62
    }
63
64
    public ItemStack func_149174_e()
65
    {
66
        return this.item;
67
    }
68
}

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

Deep Dive

Role in the protocol

S2FPacketSetSlot is the single-slot inventory sync packet, the fine-grained counterpart to the S30 full-window dump. The server emits it for every slot mutation: EntityPlayerMP.updateCraftingInventory pushes windowId/slot/stack on each container change, the cursor is synced with the (-1, -1) variant after clicks settle (lines 760, 774, 805), NetHandlerPlayServer line 554 re-sends the held hotbar slot after a swap, and ItemEditableBook pushes the signed book back into slot 0. windowId -1 means the cursor, 0 means the player inventory, anything else the open container.

Vanilla handling

NetHandlerPlayClient.handleSetSlot resolves the target container from the window id: -1 sets the player's cursor stack, 0 and the player inventory window id write into inventoryContainer, otherwise the open container receives the slot. The matching GuiScreen is notified so the renderer updates. There is no validation: the client trusts the server's slot content unconditionally, which is exactly the trust that cancel-based modules exploit. The vanilla client never sends S2F; it is strictly clientbound.

Why clients touch it

Four distinct uses in the 8 clients. Rise 5.99 Auto sniffs S2F for the Redesky captcha item and clicks it with a crafted C0E. Rise 5.99 Scaffold and Spicy BlockFly cancel every S2F so the server cannot correct the hotbar while they place blocks. Tenacity 6.0 NoSlowModule cancels window-0 slot updates while using a non-sword item, keeping the ghost-item no-slow state alive. Rise 6.x AdaptiveRefreshRateComponent treats S2F as a significant packet that forces a HUD cache redraw, and PacketUtil exposes a wrapper for the script API.

Exploit surface

Cancelling S2F is a local lie that only survives until the next window resync: the server owns slot state, and a rejected click (S32 accepted=false) triggers a full S30 dump that snaps the client back. That makes S2F cancellation a short-horizon trick, useful inside a single click loop, not a persistent desync. For inventory modules the packet is a cheap signal: an armor swap or a hotbar change arrives as one small packet, so AutoArmor-style logic can react without parsing a window. The trade-off is ordering: any module that cancels S2F upstream silently blinds every other module that reads it.

Server-Side Handling

EntityPlayerMP.updateCraftingInventory sends S2F(windowId, slot, stack) per slot change and the cursor variant (-1, -1) after click processing (lines 760, 774, 805 in the bundled sources). NetHandlerPlayServer line 554 re-sends the held item slot after a hotbar swap; ItemEditableBook line 116 pushes the signed book into slot 0. There is no rate limit and no client-side validation: handleSetSlot writes the slot into the resolved container and notifies the open GUI.

Protocol Analysis

Wire layout: byte windowId, short slot, then a Slot encoding (short item id, byte count, short damage, optional NBT; item id -1 encodes null). windowId -1 (0xFF) targets the cursor, 0 the player inventory, other values the open container. S2F is PLAY-state only and always carries exactly one slot, which is what makes it the cheapest way for a module to detect an armor equip or hotbar change. The cursor variant pairs slot -1 with windowId -1.

Anti-Cheat Landscape

No anti-cheat measures S2F: it is server-authoritative display state. The abuse is purely client-side view desync, and the detection surface is the eventual resync: a server that rejects a click re-sends S30, and any client that still behaves as if the old slot content exists is visibly desynced. Cancel-heavy movement modules (Scaffold, BlockFly) therefore risk inventory desync that manifests as phantom hotbar items rather than a flag.

implementation Implementation Cases

The single-slot sync packet and the cheapest inventory signal on the wire. Rise's Auto reads it to click captcha items, Scaffold and Spicy's BlockFly cancel it to freeze the hotbar, Tenacity's NoSlow cancels window-0 updates to preserve a ghost item, and Rise 6.x treats it as a HUD-significant packet. The server always owns slot truth; cancelling only delays the client's view.

Auto (Rise 5.99)

Automated Redesky captcha solving: detect a captcha item in a container slot via S2F and click it before the server times it out.

PacketReceiveEvent; on S2F, skip window 0 (player inventory), then check the item's display name case-insensitively for 'aqui'. On match, send C0EPacketClickWindow(windowId, slot, 0, 0, item, (short) 1919): button 0, mode 0, and an absurdly large action number the server ignores. Runs only while the redeskyAutoCaptcha setting is on.

Source: Rise 5.99, dev/rise/module/impl/other/Auto.java

Vanilla hook: PacketReceiveEvent.
Benign server automation; the fixed action number 1919 and the display-name scan are the only fingerprints, and no anti-cheat in the era flags them.
Variations: None in the corpus; the captcha logic is Redesky-specific and the rest of the module (auto register/login) works through chat packets.
Scaffold (Rise 5.99)

Cancel all incoming slot sync so the server cannot correct the client's hotbar view during the block placement loop.

onPacketReceive: if the packet is S2FPacketSetSlot, event.setCancelled(true). Every slot update is dropped while scaffolding, keeping the client's own view of the hotbar authoritative for the placement loop.

Source: Rise 5.99, dev/rise/module/impl/player/Scaffold.java

Vanilla hook: PacketReceiveEvent.
No anti-cheat flags the cancellation itself; the risk is long-horizon inventory desync, which surfaces when a rejected click forces an S30 resync.
Variations: None in the corpus; the file is 1042 lines of placement logic with this one receive-side cancel.
BlockFly (Spicy)

Block-fly movement that cancels S2F so the server cannot correct the fake block placement state.

EventPacket pre-phase: if the packet is S2FPacketSetSlot, setCanceled(true), unless killaura has a target, in which case the handler returns early so weapon switching stays synced. The module also freezes yaw and pitch on C03 and EventMotion and places blocks below the player via onPlayerRightClick.

Source: Spicy, info/spicyclient/modules/movement/BlockFly.java

Vanilla hook: EventPacket (receive path), EventSendPacket, EventMotion, EventUpdate, EventSneaking, EventRender3D.
Cancels all slot updates while flying; same desync trade-off as Scaffold, with the added killaura guard that keeps combat state accurate.
Variations: None in the corpus; Spicy's other movement modules reference C00/C0F but only BlockFly touches S2F.
NoSlowModule (Tenacity 6.0)

No-slow that preserves a ghost item by cancelling window-0 slot updates while using a non-sword item.

Vanilla mode: on MotionEvent pre, if no ghost exists call sendBypass (C0D close window 0, then C0E shift-click of the held item into its own slot to create the ghost). Then on PacketReceiveEvent, cancel every S2F whose window id is 0 while the player is using a non-sword item with no screen open, so the server's slot corrections never remove the ghost. isItemGhost resets when the player stops using the item.

Source: Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java

Vanilla hook: PacketReceiveEvent, MotionEvent, SlowDownEvent.
The ghost-item no-slow is a classic desync exploit; cancelling S2F is what keeps the ghost alive. It only survives until the next S30 or a transaction rejection.
Variations: The Watchdog mode branch is an empty stub; the corpus shows no other Tenacity module using S2F.
AdaptiveRefreshRateComponent (Rise 6.2.4, Rise 6.1.30)

HUD performance component: S2F (and S30, chat, collect-item) mark significant events that force a GuiIngameCache redraw.

PacketReceiveEvent: on S2F, reset the StopWatch and set the cache dirty so the next frame re-renders the HUD. PreMotionEvent re-evaluates dirty state every 100 ticks, on player-list/debug key changes, or while the component is disabled for a few ticks after health changes.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java

Vanilla hook: PacketReceiveEvent, PreMotionEvent, Render2DEvent.
None; the component is cosmetic and only observes the packet stream.
Variations: Identical file in 6.1.30 (path com/alan/clients/component/impl/hud/). No other client has an equivalent.
PacketReceiveEvent is the universal surface for S2F across the 8 clients. Tenacity pairs it with MotionEvent and SlowDownEvent, Spicy uses its monolithic EventPacket receive path with setCanceled.
Rise 5.99 cancels via event.setCancelled on PacketReceiveEvent. Spicy cancels via setCanceled on EventPacket. Tenacity 6.0 cancels the event and toggles its own ghost-item state. Rise 6.x has no gameplay module for S2F; it reaches the packet through AdaptiveRefreshRateComponent and the PacketUtil wrapper used by scripts.

anticheat Anti-Cheat Checks

The set-slot packet is the server's single-slot inventory correction: window id, slot, and the item placed there. It is server-authoritative display state, so anticheats do not validate it, but simulation anticheats must consume it to keep their compensated copy of the player inventory honest. The only real corpus hits are Grim's replication listener, which reads S2F to detect held-item and offhand changes, and Grim's check listener, which manufactures S2F packets to resync the client after a cancelled interaction. Everyone else ignores it.

SetSlot replication (Grim) (GrimAnticheat-Grim)

Apply the server's single-slot corrections to the compensated inventory and end stale item-use state when the held item changes.

PacketEntityReplication wraps SET_SLOT and, for window id 0 (the player inventory), schedules a transaction-sandwiched task: if the slot is the selected hotbar slot (36 + lastSlotSelected) or the offhand (45) and the item type differs from the compensated inventory, it clears the slowed-by-using-item state and resets item usage through the item reset handler. The task runs for the current and the next transaction to cover 1.8 clients that fail to send release-item packets.

Detects: Item-use desync after server-side slot corrections. It feeds NoSlow and item-use timing checks with accurate held-item state.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java

Variations: The only other anticheat that names the packet is Negativity, whose PacketType enum lists SET_SLOT as a clientbound constant; it is not consumed by any check there.
SetSlot resync on cancelled place (Grim) (GrimAnticheat-Grim)

Re-send the authoritative held-item slot to the client after a block place is cancelled, so the client's view cannot desync from the server.

CheckManagerListener handles the block-place packet; when the placement is cancelled the server-side inventory no longer matches what the client predicted, so the listener sends a WrapperPlayServerSetSlot for the main hand (slot 36 + selected) or the offhand (slot 45) carrying the platform player's actual item. The code comment calls this 'stop inventory desync from cancelling place'.

Detects: Not a detection: a correction path that prevents ghost-item and desync artifacts from cancelled placements, which is what movement modules with inventory side effects tend to produce.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/CheckManagerListener.java

Variations: No other anticheat in the corpus writes S2F packets; Grim is alone in both consuming and producing set-slot traffic.

Wiki Cross-Reference

Clientbound 0x2F: byte windowId, short slot, then Slot ItemStack encoding.

Window -1 with slot -1 updates the cursor item; window 0 updates player inventory.

Single-slot sync; full-window resync arrives separately via S30 Window Items.

MCP 1.8.9 S2FPacketSetSlot implements Packet dispatching to INetHandlerPlayClient.handleSetSlot; wire serde is readPacketData/writePacketData via readByte, readItemStackFromBuffer, readShort.

1.8.9 callers: EntityPlayerMP.sendSlotContents sends new S2FPacketSetSlot (line 860) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.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.

Module Analyses Using S2FPacketSetSlot

Full source walkthroughs of the modules and anti-cheats that use this packet.