0x0D C0DPacketCloseWindow

Player closes an inventory window (chest, crafting table, furnace, etc).

Serverbound (Client → Server) · PLAY · net/minecraft/network/play/client/C0DPacketCloseWindow.java

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

playerinventorycontainer
Comprehensive 8/8

Fields

FieldTypeDescription
windowIdbyteWindow ID of the container being closed

Wire Encoding

FieldTypeNotes
Window IDunsigned byteServer-assigned window ID from S2DPacketOpenWindow

MCP References

MCPNetHandlerPlayServer.processCloseWindow()

Handler Interface

HNDINetHandlerPlayServer

Notes

Rise 6.0 CancelInventoryMove cancels C0D to keep the inventory 'open' and allow WASD movement. RektSky B5 ChestStealer sends C0D after stealing. Jigsaw 0.26 InventoryPlus cancels C0D. Sigma 4.11 InventoryWalk cancels C0D.

Vanilla Source

C0DPacketCloseWindow.java44 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.client;
2
3
import java.io.IOException;
4
import net.minecraft.network.Packet;
5
import net.minecraft.network.PacketBuffer;
6
import net.minecraft.network.play.INetHandlerPlayServer;
7
8
public class C0DPacketCloseWindow implements Packet<INetHandlerPlayServer>
9
{
10
    private int windowId;
11
12
    public C0DPacketCloseWindow()
13
    {
14
    }
15
16
    public C0DPacketCloseWindow(int windowId)
17
    {
18
        this.windowId = windowId;
19
    }
20
21
    /**
22
     * Passes this Packet on to the NetHandler for processing.
23
     */
24
    public void processPacket(INetHandlerPlayServer handler)
25
    {
26
        handler.processCloseWindow(this);
27
    }
28
29
    /**
30
     * Reads the raw packet data from the data stream.
31
     */
32
    public void readPacketData(PacketBuffer buf) throws IOException
33
    {
34
        this.windowId = buf.readByte();
35
    }
36
37
    /**
38
     * Writes the raw packet data to the data stream.
39
     */
40
    public void writePacketData(PacketBuffer buf) throws IOException
41
    {
42
        buf.writeByte(this.windowId);
43
    }
44
}

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

Deep Dive

Role in the protocol

Closes an inventory window. One unsigned byte windowId, where 0 is the player inventory. The vanilla client sends it from EntityPlayerSP.closeScreen() with the currently open container's id; the server calls closeContainer(), which drops or returns the carried item and switches the player back to the inventory container. It is the bookend to S2DPacketOpenWindow and pairs with the C0EPacketClickWindow clicks that mutate the container.

Vanilla handling

processCloseWindow calls this.playerEntity.closeContainer() unconditionally: the server does not verify the windowId against the player's open container. That makes C0D(0) and C0D(inventoryContainer.windowId) interchangeable in module code, and a C0D with a stale id still closes whatever container is open. The client side is EntityPlayerSP.closeScreen(), which also fires when the GUI closes for any other reason.

Why clients touch it

Inventory-movement modules cancel C0D so the server-side window stays open while the player walks (Rise 5.99 InvMove, Rise 6.x CancelInventoryMove, Sigma InventoryWalk). Sort and steal managers send C0D(0) to force the server-side close after a batch of clicks (Rise 5.99 InvManager, Rise 6.x Manager, Spicy InventoryManager). Tenacity NoSlowModule sends C0D(0) plus a shift-click C0E to ghost-swap the held item while eating. Rise 6.x WatchdogDisabler emits C0D through sendUnregisteredPacket during its blink window.

Exploit surface

Cancelling C0D while moving leaves the server convinced the inventory is open; servers and anti-cheats that tie container state to movement flag this. Sending C0D(0) at the wrong moment desyncs the container: clicks after the close are answered with S2FPacketSetSlot updates for a closed window. The NoSlow trick exploits the fact that a close plus a click on window 0 re-syncs the server's view of the held slot without cancelling the item use.

Server-Side Handling

processCloseWindow unconditionally runs closeContainer(): the carried item is dropped or returned, the open container is detached, and the player inventory container becomes active. No windowId validation, no cooldown. A C0D with no open container is ignored. Ordering against C0EPacketClickWindow matters: a C0D mid-batch ends the transaction window, and later C0E packets get S2FPacketSetSlot failure responses.

Protocol Analysis

One unsigned byte (writeByte(windowId)). Window 0 is the player inventory; S2DPacketOpenWindow assigns ids from 1 upward. Because the server ignores the id, module code freely alternates between C0D(0) and C0D(inventoryContainer.windowId). The packet is sent on the main thread from closeScreen(), so module-injected copies use raw send paths to avoid GUI state.

Anti-Cheat Landscape

NCP and similar treat container state as server truth: closing a window while C03 movement continues is normal, so cancelling C0D is itself the flag surface, not the movement. Anti-cheats also correlate the NoSlow ghost pattern (C0D(0) plus C0E(0, 36+slot, 6)) with item-use state. Blink-based disablers (Rise 6.x) buffer C0D inside the blink queue so its arrival timing is controlled rather than cancelled.

implementation Implementation Cases

The window-close packet. Inventory move modules cancel it to keep the server-side window open while walking, managers and stealers send C0D(0) to force-close after click batches, NoSlowModule pairs it with a click to ghost-swap items, and WatchdogDisabler fires it through the unregistered send path during blink.

CancelInventoryMove / InvMove / InventoryWalk (Rise 5.99, Rise 6.2.4, Rise 6.1.30, Sigma 4.11)

Keep the server-side inventory open while walking by cancelling the open and close packets, then force-pressing movement keys so the client moves with the GUI up.

CancelInventoryMove cancels C16PacketClientStatus OPEN_INVENTORY_ACHIEVEMENT, C0BPacketEntityAction OPEN_INVENTORY and every C0DPacketCloseWindow on PacketSendEvent, and re-presses the movement keybindings on PreUpdateEvent. Rise 5.99 InvMove Packet mode additionally cancels C0E and re-sends it wrapped as C16 open + C0E + C0D(inventoryContainer.windowId) through PacketUtil.sendPacketWithoutEvent. Sigma InventoryWalk cancels C0D only when the CARRY setting is enabled.

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

Vanilla hook: PacketSendEvent (cancel) and PreUpdateEvent (key state).
Cancelling C0D is detectable server-side if the anti-cheat tracks the open-window state; the movement itself is legitimate, so this is a state-consistency flag, not a motion flag.
Variations: Rise 5.99's InvMove gates the behavior behind a Packet setting and re-sends rewrapped clicks. Sigma's InventoryWalk cancels C0D only under CARRY and adds per-mode sprint handling (AACP, Cubecraft) with C0B and C16 cancels.
InvManager / Manager / InventoryManager (Rise 5.99, Rise 6.2.4, Rise 6.1.30, Spicy)

Drive a server-side inventory session for auto-sort and steal: open with C0B OPEN_INVENTORY, click via C0E, close with C0D(0), all without a visible GUI.

Rise 5.99 InvManager tracks invOpen: openInvServerSide sends C0BPacketEntityAction OPEN_INVENTORY, closeInvServerSide sends C0DPacketCloseWindow(0). Spicy InventoryManager tracks isInventoryOpen from the packet stream (C0D sets closed, C16 OPEN_INVENTORY sets open) and closeInv() sends C0D(inventoryContainer.windowId).

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

Vanilla hook: Module state methods; sends via addToSendQueue, not event interception.
A server-side inventory that opens and closes rapidly looks like GUI spam; the click and close pattern is the measurable surface, not the C0D itself.
Variations: Rise 6.x Manager sends C0D(inventoryContainer.windowId) after its open cycle. Spicy tracks open state passively in both onEvent and onEventWhenDisabled, and its autoArmor module resets its timer whenever a packet batch is sent.
WatchdogDisabler (Rise 6.2.4, Rise 6.1.30)

Emit C0D outside the event stream so the inventory close participates in a blink sequence without being cancellable or reorderable by other modules.

With the Inventory toggle on, clicks on the player inventory are cancelled on PacketSendEvent and re-sent unregistered as C16 OPEN_INVENTORY plus the C0E; on the next PreUpdate a tick counter fires BlinkComponent.dispatch and sends C0D(inventoryContainer.windowId) via sendUnregisteredPacket on the raw NetworkManager.

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

Vanilla hook: PreUpdateEvent, PacketSendEvent; sendUnregisteredPacket for stealth.
The blink behavior is the risk: holding inventory packets and releasing them on a timer is a classic Watchdog flag; the C0D itself is incidental.
Variations: Rise 6.1.30's WatchdogDisabler has the same C0D send at its line ~101; 6.2.4 moved it to line ~217 inside the ticked inventory branch.
NoSlowModule (Tenacity 6.0)

Cancel the server-side slowdown while eating or using items by ghost-swapping the held item: close window 0 and shift-click the current slot back.

While using an item with no GUI open, sendBypass() pushes C0DPacketCloseWindow(0) then C0EPacketClickWindow(0, 36 + currentItem, 0, 6, null, nextTransactionID) into the send queue, setting isItemGhost. The S2FPacketSetSlot cancels on receive keep the ghost state invisible.

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

Vanilla hook: MotionEvent pre and PacketReceiveEvent for S2FPacketSetSlot.
The close-click pair on window 0 is a recognized NoSlow signature; anti-cheats that correlate C0D(0) + C0E(0, slot, 6) with item use flag it.
Variations: None in the corpus; Tenacity's PacketUtil also lists C0D among packet types that bypass its send queue.
AutoArmor (LiquidSense Dev)

Close the server-side inventory after simulated shift-click armor swaps, so the open/close cycle completes without a visible GUI.

With SimulateInventory on and no GuiInventory open, move() sends C16 OPEN_INVENTORY_ACHIEVEMENT, runs playerController.windowClick, then sends an empty C0DPacketCloseWindow (default window 0) to close the window the server thinks opened. Hotbar slots are fake-equipped through C09/C08 instead of clicks.

Source: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java

Vanilla hook: Render3DEvent tick; send via mc.getNetHandler().addToSendQueue.
The C16-open + click + C0D-close triplet is the same shape InvMove modules produce, but here it is bounded to one short burst per swap, which reads as legitimate GUI use to servers that mirror container state.
Variations: LiquidSense Dev's auto armor is the only one in the corpus that closes with a bare C0D() after faking the open; Sigma and Spicy use their own inventory managers.
KeepContainer (LiquidSense Dev)

Reopen a previously closed container anywhere by cancelling the client's own C0D and keeping the cached GuiContainer around for an INSERT-key reopen.

ScreenEvent caches any GuiContainer (excluding GuiInventory); PacketEvent cancels every outgoing C0DPacketCloseWindow so the container object stays alive, and tracks S2EPacketCloseWindow to drop the cache when the server closes the window. onDisable sends a real C0D with the cached windowId as cleanup. Pressing INSERT re-displays the cached GUI.

Source: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/KeepContainer.java

Vanilla hook: ScreenEvent, KeyEvent, PacketEvent (send and receive sides).
Cancelling C0D is the same state-consistency flag as InvMove: the server never sees the window close while the player moves. The S2E tracking keeps the local container in sync so a server-initiated close does not desync the cache.
Variations: No equivalent reopen-container module in the other clients; Rise 6.x buffers C0D in blink queues instead.
InventoryUtils (November Recode 2.0)

Utility closeCurrentInventory() that sends C0D with the live windowId, used by November's inventory manager and modules to close the server-side window after silent interactions.

closeCurrentInventory() pushes new C0DPacketCloseWindow(windowId()) into mc.thePlayer.sendQueue; windowId() reads the player's openContainer and returns 0 when null. A companion openInventory() sends C0B OPEN_INVENTORY for the paired open.

Source: November Recode 2.0, utility/player/InventoryUtils.java

Vanilla hook: No event hook; a static helper called from inventory code paths.
Using the live windowId keeps the close packet valid for whatever container is open, which avoids the stale-id edge cases of hardcoded C0D(0).
LuaEventPacket (November Recode 2.0)

Expose C0D to November's Lua scripting API as id 0x0D with a direction, letting scripts intercept window closes.

The static packetIds table maps C0DPacketCloseWindow.class to 0x0D; the wrapper constructor copies id and direction ('out' for serverbound) from the EventPacket so Lua scripts can match on the numeric id.

Source: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java

Vanilla hook: EventPacket.Out through the scripting bridge.
None; read-only mapping.
PacketSendEvent on all clients. Rise 6.x pairs it with BlinkComponent.dispatch and the sendUnregisteredPacket raw path. Tenacity's PacketUtil counts C0D among packet types that bypass the send queue filter.
Classic clients cancel via event.cancel() or setCancelled. Rise 5.99 re-sends rewrapped packets via PacketUtil.sendPacketWithoutEvent. Rise 6.x distinguishes send (event bus) from sendUnregisteredPacket (raw NetworkManager). Spicy tracks open state and emits C0D from module methods rather than event interception. LiquidSense Dev sends C0D via mc.getNetHandler().addToSendQueue (bare constructor) and cancels it via PacketEvent.cancelEvent; November Recode 2.0 closes with the resolved windowId through InventoryUtils and exposes 0x0D to scripts.

anticheat Anti-Cheat Checks

C0D is the one serverbound packet in this batch, and it is a state signal: closing a window flips the server-side inventory-open state, which is what inventory-move and chest-stealer detection keys on. Real consumers are Azure InvTweaksA (close while sprinting), Daedalus ActionProcessor (close clears openInventory), Intave InventoryTracker (close state plus the beacon special case) and Kauri's PacketHandler (both directions). The rest is wrappers (Artemis GPacketPlayClientWindowClose, FlopAC WrappedInCloseWindowPacket, BendEye-Perus isCloseWindow) and one keyword hit that never reads the packet: FlopAC InventoryC is a click-delay chest-stealer check driven by WINDOW_CLICK events.

InvTweaksA (Azure) (AimbotPvP-azure-anticheat)

Classic inventory-tweaks detection: closing a window while sprinting is the walking-with-inventory-open tell.

InvTweaksA hooks the inbound packet stream and checks the type: when PacketPlayInCloseWindow arrives while the Bukkit player is sprinting, it calls onViolation with a 60000 ms cooldown. Azure's PlayerStats also records the close-window type in its per-packet stats.

Detects: Inventory-tweaks and chest-stealer clients that close the GUI and keep sprinting, plus the walk-while-inventory-open pattern generally.

Source: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/invtweaks/InvTweaksA.java

Variations: Azure is the only classic anticheat with a dedicated close-window check. Its PlayerStats counter (line 68) records the type in the same hook. No other classic anticheat in the corpus flags the close packet directly.
ActionProcessor close-window state (Daedalus) (funkemunky-Daedalus)

State sync: a close-window packet clears the openInventory flag that Daedalus's inventory and movement checks read.

ActionProcessor is fed by PacketListeners, which wraps the inbound close-window packet (line 103) and calls the update overload. The close-window overload sets openInventory = false, paired with the C0B OPEN_INVENTORY branch of the entity-action overload that sets it true. Checks that must know whether the player has a GUI open read the flag.

Detects: Nothing directly: state bookkeeping. It makes GUI-state-dependent checks such as inventory move and click timing accurate.

Source: funkemunky-Daedalus, Daedalus/src/cc/funkemunky/anticheat/api/data/processors/ActionProcessor.java

Variations: Kauri PacketHandler wraps both directions: the inbound CLOSE_WINDOW branch sets inventoryOpen false immediately (lines 271-273), and the server CLOSE_WINDOW branch defers the same write to a keepalive action (lines 538-540) so the state lands at the client's tick.
InventoryTracker close-window state (Intave) (intave-intave)

Track the player's inventory-open state from the close-window packet, with a workaround for the beacon window that never sends one.

InventoryTracker subscribes to the CLOSE_WINDOW inbound packet at LOW priority and closes the inventory: receiveCloseWindow calls closeInventory, which flips InventoryMetadata's open state to false. On the open side it special-cases the beacon container: since the client never sends a close packet for a beacon window, opening one skips the open-state update entirely, so the tracking never gets stuck with a stale open inventory.

Detects: Nothing directly: state tracking. The open and close state feeds the inventory-analysis checks, including the ChestStealer violations that the /intave history command reports.

Source: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/InventoryTracker.java

Variations: FlopAC's InventoryC flags chest-stealer behavior from click-delay statistics but never reads the close-window packet; its C0D corpus hit is the flag message text only. Artemis's GPacketPlayClientWindowClose and FlopAC's WrappedInCloseWindowPacket are wrappers, and BendEye-Perus exposes isCloseWindow as a generic packet predicate.

Wiki Cross-Reference

Vanilla clients send a close-window packet with window ID 0 to close their own inventory even though no open packet is ever sent for it.

MCP 1.8.9 C0DPacketCloseWindow implements Packet dispatching to INetHandlerPlayServer.processCloseWindow; wire serde is readPacketData/writePacketData via readByte.

1.8.9 callers: EntityPlayerSP.closeScreen sends new C0DPacketCloseWindow (line 332): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.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 C0DPacketCloseWindow

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