Skip to content
mc-protocol
Esc
↑↓navigate↵open⌘Jpreview
On this page

Container Set Content

Play 0x12, server → client.

play · 0x12 · clientbound (server → client)

Replaces all slot contents of the window windowId with items, plus the item held on the cursor (carriedItem). Window 0 is the player inventory. The server sends it when a window opens or when the full contents need to be resynced. The client applies the slots and uses stateId to detect stale updates.

Sent by the server, read by the client. Listen for it with client.on("ContainerSetContent", (data) => …) on the receiving side.

Fields

Field Type Notes
windowId ContainerID
stateId VarInt
items Array also slotData
carriedItem Slot

Send it

await client.sendPacket("ContainerSetContent", {
  windowId: /* ContainerID */,
  stateId: /* VarInt */,
  items: /* Array */,
  carriedItem: /* Slot */,
});

Field aliases listed under Notes are accepted as alternative keys when writing.

Source: src/Core/Versions/776/Packets/play/clientbound/ContainerSetContent.ts

Was this page helpful?