---
title: Container Click
description: "Play 0x12, client → server."
---

`play` · `0x12` · **serverbound** (client → server)

Sent when the player clicks a slot in an open container. `windowId` and `stateId` identify the container and its revision, `slot`, `mouseButton`, and `mode` describe the click, `changedSlots` lists the client's predicted slot contents, and `cursorItem` is the predicted carried item. The server applies the click on its own copy and sends corrections if the prediction differs.

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

## Fields

| Field | Type | Notes |
|---|---|---|
| `windowId` | ContainerID |  |
| `stateId` | VarInt |  |
| `slot` | Short |  |
| `mouseButton` | Byte | also `button` |
| `mode` | VarInt |  |
| `changedSlots` | Array |  |
| `cursorItem` | Optional | also `carriedItem` |

## Send it

```ts
await client.sendPacket("ContainerClick", {
  windowId: /* ContainerID */,
  stateId: /* VarInt */,
  slot: /* Short */,
  mouseButton: /* Byte */,
  mode: /* VarInt */,
  changedSlots: /* Array */,
  cursorItem: /* Optional */,
});
```

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

Source: [`src/Core/Versions/776/Packets/play/serverbound/ContainerClick.ts`](https://github.com/GDLev/mc-protocol/blob/master/src/Core/Versions/776/Packets/play/serverbound/ContainerClick.ts)
