0x2D S2DPacketOpenWindow

Opens an inventory GUI window (chest, crafting table, furnace, enchantment table, etc.) with window ID, type, title, and slot count.

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

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

inventorycontainer
Comprehensive 8/8

Fields

FieldTypeDescription
windowIdunsigned byteServer-assigned window ID
inventoryTypeStringGUI type identifier (minecraft:chest, minecraft:crafting_table, etc.)
windowTitleIChatComponent (JSON)Window title displayed in GUI
slotCountunsigned byteNumber of slots in the window
entityIdintEntity ID for EntityHorse type (only present for horse GUIs)

Wire Encoding

FieldTypeNotes
Window IDUnsigned Byte
Inventory TypeStringminecraft:chest, etc.
Window TitleChat Component (JSON)Displayed as window title
Slot CountUnsigned Byte
Entity ID (if horse)intOnly for EntityHorse type

MCP References

MCPNetHandlerPlayClient.handleOpenWindow()

Handler Interface

HNDINetHandlerPlayClient

Notes

Inventory types: minecraft:chest, crafting_table, furnace, dispenser, enchanting_table, brewing_stand, villager, beacon, anvil, hopper, dropper, EntityHorse. RektSky B5 ChestStealer intercepts this packet for silent chest handling. It cancels the vanilla open, stores the window data, and manages the chest entirely via packet-level manipulation.

Vanilla Source

S2DPacketOpenWindow.java109 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.network.Packet;
5
import net.minecraft.network.PacketBuffer;
6
import net.minecraft.network.play.INetHandlerPlayClient;
7
import net.minecraft.util.IChatComponent;
8
9
public class S2DPacketOpenWindow implements Packet<INetHandlerPlayClient>
10
{
11
    private int windowId;
12
    private String inventoryType;
13
    private IChatComponent windowTitle;
14
    private int slotCount;
15
    private int entityId;
16
17
    public S2DPacketOpenWindow()
18
    {
19
    }
20
21
    public S2DPacketOpenWindow(int incomingWindowId, String incomingWindowTitle, IChatComponent windowTitleIn)
22
    {
23
        this(incomingWindowId, incomingWindowTitle, windowTitleIn, 0);
24
    }
25
26
    public S2DPacketOpenWindow(int windowIdIn, String guiId, IChatComponent windowTitleIn, int slotCountIn)
27
    {
28
        this.windowId = windowIdIn;
29
        this.inventoryType = guiId;
30
        this.windowTitle = windowTitleIn;
31
        this.slotCount = slotCountIn;
32
    }
33
34
    public S2DPacketOpenWindow(int windowIdIn, String guiId, IChatComponent windowTitleIn, int slotCountIn, int incomingEntityId)
35
    {
36
        this(windowIdIn, guiId, windowTitleIn, slotCountIn);
37
        this.entityId = incomingEntityId;
38
    }
39
40
    /**
41
     * Passes this Packet on to the NetHandler for processing.
42
     */
43
    public void processPacket(INetHandlerPlayClient handler)
44
    {
45
        handler.handleOpenWindow(this);
46
    }
47
48
    /**
49
     * Reads the raw packet data from the data stream.
50
     */
51
    public void readPacketData(PacketBuffer buf) throws IOException
52
    {
53
        this.windowId = buf.readUnsignedByte();
54
        this.inventoryType = buf.readStringFromBuffer(32);
55
        this.windowTitle = buf.readChatComponent();
56
        this.slotCount = buf.readUnsignedByte();
57
58
        if (this.inventoryType.equals("EntityHorse"))
59
        {
60
            this.entityId = buf.readInt();
61
        }
62
    }
63
64
    /**
65
     * Writes the raw packet data to the data stream.
66
     */
67
    public void writePacketData(PacketBuffer buf) throws IOException
68
    {
69
        buf.writeByte(this.windowId);
70
        buf.writeString(this.inventoryType);
71
        buf.writeChatComponent(this.windowTitle);
72
        buf.writeByte(this.slotCount);
73
74
        if (this.inventoryType.equals("EntityHorse"))
75
        {
76
            buf.writeInt(this.entityId);
77
        }
78
    }
79
80
    public int getWindowId()
81
    {
82
        return this.windowId;
83
    }
84
85
    public String getGuiId()
86
    {
87
        return this.inventoryType;
88
    }
89
90
    public IChatComponent getWindowTitle()
91
    {
92
        return this.windowTitle;
93
    }
94
95
    public int getSlotCount()
96
    {
97
        return this.slotCount;
98
    }
99
100
    public int getEntityId()
101
    {
102
        return this.entityId;
103
    }
104
105
    public boolean hasSlots()
106
    {
107
        return this.slotCount > 0;
108
    }
109
}

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

Deep Dive

Role in the protocol

Opens an inventory window on the client. The server assigns a windowId (incrementing per player, wrapping at 256), picks a GUI type string, sends the title as a chat component, the slot count, and for EntityHorse windows the horse's entityId. The client switches on the type string: minecraft:container becomes a chest GUI, minecraft:villager a trade GUI, EntityHorse a horse inventory, anything else a LocalBlockIntercommunication GUI. The windowId must then be echoed back on every C0E click and C0D close.

Vanilla handling

NetHandlerPlayClient.handleOpenWindow matches the type string and calls the matching display method (displayGUIChest, displayVillagerTradeGui, displayGUIHorse, displayGui), then stamps the windowId onto the player's openContainer. The horse branch looks up the entity by id and silently does nothing if the entity is missing. Server-side, EntityPlayerMP.displayGUIChest and openGui build the packet with the player's currentWindowId, which increments on every open.

Why clients touch it

Two Rise 6.x modules, both cancelling the packet for combat-adjacent reasons. WorldGuardRegen suppresses S2D while its regen burst is active (ticks <= 1) so a server-initiated window cannot interrupt the position-desync regen sequence. GodMode cancels every S2D unconditionally, which keeps the server's window state desynced from the client as part of the godmode attack-desync. The context's ChestStealer/AutoArmor/ServerCrasher open-window usage does not exist in this corpus; the 8 clients contain no inventory-stealing S2D consumer.

Exploit surface

The windowId protocol is a state machine: the client must mirror every S2D with an open container and echo the id in later clicks. Cancelling S2D (Rise 6.x) leaves the server believing a window is open while the client never shows it, which is exactly the desync GodMode and WorldGuardRegen exploit. Server-side open-window spam (ServerCrasher style) is a client DoS: each S2D forces a GUI construction, and rapid-fire opens desync the container state. The EntityHorse branch's entity lookup is also a soft spot: a stale id silently drops the window.

Server-Side Handling

EntityPlayerMP.displayGUIChest/openGui increments currentWindowId, opens the container server-side, and sends S2D with the id, GUI type, display name, and slot count (plus entityId for horses). The client must echo the windowId in C0E clicks and C0D closes or the server container stays open with stale state. Vanilla performs no validation that the client actually opened the window, which is the desync window both Rise 6.x modules rely on.

Protocol Analysis

Encoding: unsigned byte windowId, String guiId (minecraft:container, minecraft:villager, EntityHorse, or a block interaction id), IChatComponent title, unsigned byte slotCount, then int entityId only when guiId is EntityHorse. windowId wraps at 256 and the client stamps it on openContainer.windowId. The type string is the discriminator; there is no numeric window-type enum on the wire in 1.8.9.

Anti-Cheat Landscape

Anti-cheats track window state through the C0E/C0D echo trail, not through S2D itself. The Rise 6.x cancels create a server-side phantom container: the server keeps sending window updates (S2F, S30) to a window the client never opened, which is detectable if an anti-cheat correlates window items with click packets. The trade-off is why WorldGuardRegen only cancels during the short regen burst (ticks <= 1) while GodMode accepts the permanent desync.

implementation Implementation Cases

The window-open packet, and the desync hinge for two Rise 6.x combat modules: WorldGuardRegen suppresses it during regen bursts, GodMode cancels it permanently to keep the server-client container state split. No chest-stealing or shop-detection module exists in the corpus; the windowId echo contract is what makes cancellation useful.

WorldGuardRegen (window suppress) (Rise 6.2.4, Rise 6.1.30)

Prevent a server-initiated window from interrupting the regen position-desync sequence.

A Regen mode. Its PreMotionEvent handler drops the player y by 0.05 and holds yaw/pitch while health is below the threshold; the PacketSendEvent handler wraps attacks in a C04-teleport/attack/C04-return sandwich. The PacketReceiveEvent handler cancels any S2D while ticks <= 1, i.e. during the active regen burst, so the server cannot open a container mid-sequence and break the state machine.

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

Vanilla hook: PreMotionEvent, PacketSendEvent, PacketReceiveEvent, StrafeEvent, MoveInputEvent.
The cancel is brief and purposeful: a phantom window for one or two ticks is below most anti-cheat window-state checks, which expect C0D echoes after a delay. Long cancels would desync window items.
Variations: Identical file in Rise 6.1.30 under com/alan/clients/module/impl/combat/regen/.
GodMode (window desync) (Rise 6.2.4, Rise 6.1.30)

Cancel every open-window packet so the server's container state permanently diverges from the client's.

Cancels all S2D in PacketReceiveEvent. Combined with the module's core trick (drop y by 0.05 every pre-motion, wrap attacks in a position sandwich via PacketUtil.sendNoEvent), the server keeps an open phantom container while the client stays in normal movement. onEnable snapshots yaw/pitch for the desync frames.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/GodMode.java

Vanilla hook: PreMotionEvent, PacketSendEvent, PacketReceiveEvent, StrafeEvent, MoveInputEvent.
High detection risk by design: permanent window desync plus position desync is a classic godmode signature. Modern anti-cheats correlate C0E/C0D history with window ids and flag clicks against windows the client never opened.
Variations: Identical file in Rise 6.1.30. Rise 5.99 has no S2D reference in any module.
Both Rise 6.x modules filter S2D on PacketReceiveEvent; the surrounding exploit logic lives in PreMotionEvent and PacketSendEvent.
Rise 6.1.30 and 6.2.4 ship identical GodMode and WorldGuardRegen files. Memeware, Nekoware, Sigma, Spicy and Tenacity reference S2D only in vanilla sources. No client uses S2D for chest stealing or shop detection.

anticheat Anti-Cheat Checks

The open-window packet is the state anchor for inventory anti-cheat: modern anticheats mirror the S2D open into a simulated window state and then validate every C0E click against it. Grim records the container id and type on the send side and rejects impossible click combinations, and its CompensatedInventory runs the full openWindowID state machine. Intave timestamps the open so its inventory-click-analysis check can measure click delay, and Artemis transaction-confirms the open to flip the inventory-open flag. Classic repos stop at wrappers (FlopAC WrappedOutOpenWindow, Kauri PacketHandler, Negativity PacketType).

BadPacketsP invalid click (Grim) (GrimAnticheat-Grim)

Reject crafted window-click packets whose button values are impossible for the click type.

PacketSendListener records containerType and containerId from the S2D OPEN_WINDOW packet; PacketReceiveListener then validates every C0E click: button range per click type (PICKUP/QUICK_MOVE/CLONE 0-2, SWAP 0-8 or 40, THROW 0-1, QUICK_CRAFT a fixed set, PICKUP_ALL 0). The verbose line also reports whether the click's window id matches the container opened by S2D, and the packet is cancelled on repeated flags.

Detects: Crafted C0E packets used for packet-crash exploits and invalid-click lag machines, plus clicks that reference a window the server never opened.

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

Variations: CrashD in the same repo combines the S2D open with click parsing to drive crash checks; FlopAC WrappedOutOpenWindow and Kauri PacketHandler only wrap the packet.
CompensatedInventory open-window state (Grim) (GrimAnticheat-Grim)

Emulate the server-side inventory and open-window id so click, slot and item packets can be validated against client-visible state.

On the S2D OPEN_WINDOW send it stores openWindowID from the container id (the horse-window variant is handled separately); the S2F set-slot and S30 window-items handlers then route updates to the player inventory (id 0) or the opened menu (id equal to openWindowID). Clicks against a mismatched window id are treated as invalid, and closeActiveInventory resets the menu, carried item and id.

Detects: Inventory desync, chest-stealer and inventory-manipulation that click windows the server never opened, and carried-item spoofing.

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

Variations: AbstractContainerMenu in the same repo replays valid click semantics on the emulated menu.
Inventory click delay analysis (Intave) (intave-intave)

Flag chest-stealer and auto-inventory modules by measuring click timing and slot distance against the window open.

The openWindowPacket subscription on outbound OPEN_WINDOW records lastWindowOpenTimestamp and marks the window open under tick feedback. The windowClickPacket subscription collects distance-time and slot-time samples per window; on close, if the sample count exceeds 30 it runs statistics (mean, variance, slope, Pearson correlation) and flags constant-speed item taking, excessive speed, and distance-indifferent patterns, nerfing the player's attack damage past 100 VL.

Detects: ChestStealer, inventory cleaners and refill modules that take items at uniform speed or ignore slot distance.

Source: intave-intave, src/main/java/de/jpx3/intave/check/other/inventoryclickanalysis/RegrDelayAnalyzer.java

Variations: NotOpenCheck in the same package flags clicks when no window was opened; PacketEventDispatch.sentWindowOpen stores the slot count announced by S2D.
WindowOpen wrapper and inventory-open flag (Artemis) (artemisac-artemis-minecraft-anticheat)

Register the S2D packet and transaction-confirm the open so Artemis knows the player's inventory is open.

GPacketPlayServerWindowOpen wraps PacketPlayOutOpenWindow with a readable buffer; EmulatorPreProcessor handles it by scheduling a transaction-confirmed PacketAction whose pre() stops item use and sets the inventory-open flag, so movement and click checks can distinguish windowed from normal play at the right tick.

Detects: Chest-stealer and window-state desync where clicks or movement are processed against a stale inventory state.

Source: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerWindowOpen.java

Variations: PacketExecutor registers the wrapper; PacketPlayServerWindowOpen is the API interface. Kauri (funkemunky-KauriV3) PacketHandler sets inventoryOpen(true) and resets lastInventoryOpen on a keepalive-confirmed OPEN_WINDOW.

Wiki Cross-Reference

Clientbound 0x2D: unsigned byte windowId, type string, chat title, unsigned byte slot count.

Type strings include minecraft:container, minecraft:villager and EntityHorse.

Extra int entityId follows only for EntityHorse windows; ID is echoed in C0E and C0D.

MCP 1.8.9 S2DPacketOpenWindow implements Packet dispatching to INetHandlerPlayClient.handleOpenWindow; wire serde is readPacketData/writePacketData via readChatComponent, readInt, readStringFromBuffer, readUnsignedByte.

1.8.9 callers: EntityPlayerMP.displayGui sends new S2DPacketOpenWindow (line 758): 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.