> For the complete documentation index, see [llms.txt](https://daikirai.gitbook.io/scripting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daikirai.gitbook.io/scripting/documentation/inventory.md).

# inventory

{% hint style="info" %}
see also: [`itemstack`](/scripting/documentation/itemstack.md) for `ItemStack` properties.
{% endhint %}

### click

clicks a slot in the current container.

```java
inventory.click(int slot, int button, int mode);
```

***

### getBookContents

returns the pages of the currently open book as raw json strings.

```java
List<String> pages = inventory.getBookContents();
```

***

### getChest

returns the chest name when a chest is open, otherwise an empty string.

```java
String chestName = inventory.getChest();
```

***

### getChestSize

returns the size of the opened chest inventory, or `0` if no chest is open.

```java
int chestSize = inventory.getChestSize();
```

***

### getContainer

returns the simple class name of the currently open container.

```java
String container = inventory.getContainer();
```

***

### getSize

returns the size of the player's inventory.

```java
int size = inventory.getSize();
```

***

### getSlot

returns the currently selected hotbar slot index.

```java
int slot = inventory.getSlot();
```

***

### getStackInChestSlot

returns the item in the specified chest slot as an [`ItemStack`](/scripting/documentation/itemstack.md), or `null` when unavailable.

```java
ItemStack item = inventory.getStackInChestSlot(int slot);
```

***

### getStackInSlot

returns the item in the specified player inventory slot as an [`ItemStack`](/scripting/documentation/itemstack.md).

```java
ItemStack item = inventory.getStackInSlot(int slot);
```

***

### open

simulates opening the inventory gui.

```java
inventory.open();
```

***

### setSlot

sets the currently selected hotbar slot.

```java
inventory.setSlot(int slot);
```
