> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cheart.getvapu.today/llms.txt
> Use this file to discover all available pages before exploring further.

# inventory

> 背包 / 容器 / slot spoof

### 槽位

```java theme={null}
int  inventory.getSlot()                   // 当前 hotbar 选中（0-8）
void inventory.setSlot(int slot)
int  inventory.getSize()                   // 玩家背包总槽数
ItemStack inventory.getStackInSlot(int slot)
void inventory.open()                      // 打开自己背包 GUI
```

### 容器 / 箱子

```java theme={null}
String    inventory.getChest()             // 当前箱子标题（非箱子空串）
int       inventory.getChestSize()
String    inventory.getContainer()         // 任意打开容器的标题
ItemStack inventory.getStackInChestSlot(int slot)
```

### 交互点击

```java theme={null}
inventory.click(int slot, int button, int mode)
```

`mode`

| mode | 动作                                     |
| ---- | -------------------------------------- |
| 0    | PICKUP（普通左右键）                          |
| 1    | QUICK\_MOVE（shift+click）               |
| 2    | SWAP（数字键换 hotbar，button = 目标 hotbar 槽） |
| 3    | CLONE（创造中键）                            |
| 4    | THROW（Q 扔）                             |
| 5    | QUICK\_CRAFT（拖拽分堆）                     |
| 6    | PICKUP\_ALL（双击整理）                      |

### 书

```java theme={null}
List<String> inventory.getBookContents()    // 主手 written/writable book 的 pages
```

### Slot spoof

```java theme={null}
void    inventory.startSpoof(int slot)     // 静默切槽（用户不感知）
void    inventory.stopSpoof()
boolean inventory.isSpoofing()
void    inventory.switchTo(int slot)       // 正常切（用户第一视角会渲染）
boolean inventory.switchBack()             // 切回 switchTo 之前
```
