---
title: Set Player Inventory
description: "Play 0x6C, server → client."
---

`play` · `0x6C` · **clientbound** (server → client)

Sets one slot of the player's own inventory to `contents`. The server sends it when a single inventory slot changes while no container is open or the change is outside the open container.

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

## Fields

| Field | Type | Notes |
|---|---|---|
| `slotId` | VarInt |  |
| `contents` | [Slot](/docs/items) |  |

## Send it

```ts
import { helpers } from "mc-protocol";

// Server-side connection, after entering play state.
await client.sendPacket("SetPlayerInventory", {
  slotId: 0, // first hotbar slot
  contents: helpers.createSlot("diamond_sword", {
    name: { text: "Excalibur", color: "gold" },
    lore: ["Forged in TypeScript"],
    unbreakable: true,
    glint: true,
  }),
});

// Clear the slot again.
await client.sendPacket("SetPlayerInventory", { slotId: 0, contents: helpers.emptySlot() });
```

`contents` is a [Slot](/docs/items). `helpers.createSlot` and `helpers.emptySlot` return the plain object; the writer derives the component counts. For a filled map, use [createMapSlot](/docs/maps#createmapslotmapid-options). See [Items and slots](/docs/items) for every option.

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

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