> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/newgen/api/net/minecraft/world/entity/player/inventory.md).

# Inventory

A player's inventory. Slots 0-8 are the hotbar, 9-35 the rest, 36-39 armor (boots to helmet), 40 the offhand.

### Properties

#### armor

> `readonly` **armor**: [`ItemStack`](/newgen/api/net/minecraft/world/item/itemstack.md)\[]

The worn armor as boots, leggings, chestplate, helmet.

***

#### containerMenu

> `readonly` **containerMenu**: [`AbstractContainerMenu`](/newgen/api/net/minecraft/world/inventory/abstractcontainermenu.md)

The menu the player has open, or the inventory menu when none is.

**Remarks**

Its container id is what slot clicks must carry.

***

#### freeSlot

> `readonly` **freeSlot**: `number`

The first empty main slot, or -1 when full.

***

#### inventoryMenu

> `readonly` **inventoryMenu**: [`AbstractContainerMenu`](/newgen/api/net/minecraft/world/inventory/abstractcontainermenu.md)

The player's own inventory menu, which is always available.

***

#### isFull

> `readonly` **isFull**: `boolean`

Whether every main slot holds something.

***

#### items

> `readonly` **items**: [`ItemStack`](/newgen/api/net/minecraft/world/item/itemstack.md)\[]

The 36 main slots: the hotbar first, then the rest.

***

#### offhand

> `readonly` **offhand**: [`ItemStack`](/newgen/api/net/minecraft/world/item/itemstack.md)

The item in the offhand.

***

#### selectedItem

> `readonly` **selectedItem**: [`ItemStack`](/newgen/api/net/minecraft/world/item/itemstack.md)

The item in the selected hotbar slot.

***

#### selectedSlot

> **selectedSlot**: `number`

The selected hotbar slot, 0 to 8.

**Remarks**

Setting it only changes the client. Vanilla tells the server on the next tick, or before the next attack or use.

***

#### size

> `readonly` **size**: `number`

The number of slots.

### Methods

#### countItem()

> **countItem**(`idOrTag`): `number`

How many of an item the main slots and the offhand hold in total.

**Parameters**

**idOrTag**

`string`

An item id, or a tag with a leading #.

**Returns**

`number`

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)

***

#### findHotbarSlot()

> **findHotbarSlot**(`itemId`): `number`

The first hotbar slot holding an item, or -1.

**Parameters**

**itemId**

`string`

The item id, e.g. "minecraft:golden\_apple".

**Returns**

`number`

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)

***

#### findSlot()

> **findSlot**(`itemId`): `number`

The first main slot holding an item, or -1.

**Parameters**

**itemId**

`string`

The item id, e.g. "minecraft:golden\_apple".

**Returns**

`number`

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)

***

#### findSlotMatching()

> **findSlotMatching**(`idOrTag`): `number`

The first main slot holding an item that is the given item or in the given tag, or -1.

**Parameters**

**idOrTag**

`string`

An item id, or a tag with a leading #, like "#minecraft:swords".

**Returns**

`number`

**See**

[Item tags](https://minecraft.wiki/w/Item_tag_\(Java_Edition\))

***

#### getCooldownPercent()

> **getCooldownPercent**(`itemId`): `number`

How much of the cooldown for an item is left, from 1 down to 0.

**Parameters**

**itemId**

`string`

The item id.

**Returns**

`number`

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)

***

#### getItem()

> **getItem**(`slot`): [`ItemStack`](/newgen/api/net/minecraft/world/item/itemstack.md)

The item in a slot.

**Parameters**

**slot**

`number`

The slot, 0 to 40.

**Returns**

[`ItemStack`](/newgen/api/net/minecraft/world/item/itemstack.md)

***

#### isOnCooldown()

> **isOnCooldown**(`itemId`): `boolean`

Whether the player cannot use an item yet, e.g. an ender pearl just thrown.

**Parameters**

**itemId**

`string`

The item id.

**Returns**

`boolean`

**See**

[Item ids](https://minecraft.wiki/w/Java_Edition_data_values/Items)
