# Inventory.yml Tutorial

Here you can modify aspects of the inventories of Codex.

## Inventories <a href="#inventories" id="inventories"></a>

There are different inventories on the plugin:

* **main\_inventory:** Main inventory opened using the `/codex` command. Categories will appear here. You can even create more inventories like this one.

{% hint style="warning" %}
The `main_inventory` inventory must not be removed from the inventory.yml file. You can create your own inventories following the same format under the inventories path if you need to.
{% endhint %}

* **category\_\<category>:** You must create inventories associated with a category, replacing the `<category>` tag with the name of the category. For example, `category_monsters` represents the inventory for the `monsters` category (monsters.yml file). If you create a new category file, for example `"npcs.yml"`, then you must add a new inventory on the inventory.yml file called `category_npcs`.

{% hint style="success" %}
If you want to create multiple inventories associated with a category, for example multiple pages, you can add an inventory with the following name:

`category_<category>;<something>`

This inventory will be also associated with the selected category, meaning you can add its discoveries inside. For example, if you need multiple pages for the monsters category, you can create the following inventories:

`category_monsters`

`category_monsters;page2`

`category_monsters;page3`

Then, using the open\_inventory property, you can redirect the player to the different pages.
{% endhint %}

## Inventories Properties <a href="#inventories-properties" id="inventories-properties"></a>

Each inventory has 3 properties show below:

```yaml
inventories:
  main_inventory:
    slots: 45
    title: "&4Codex &7» &8All Categories"
    21:
      type: "category: history"
    22:
      type: "category: regions"
    23:
      type: "category: monsters"
    0;8;36;44:
      item:
        id: RED_STAINED_GLASS_PANE
        name: " "
    1;7;9;17;27;35;37;43:
      item:
        id: BLACK_STAINED_GLASS_PANE
        name: " "
    40:
      item:
        id: BARRIER
        name: '&7Close'
      click_actions:
        - "message: &7Closing the menu."
        - "close_inventory"
```

### **Slots** <a href="#slots" id="slots"></a>

Defines the amount of slots this inventory will have. You can only use 9, 18, 27, 36, 45 or 54.

### **Title** <a href="#title" id="title"></a>

Defines the title of this inventory.

### **Item Slot** <a href="#item-slot" id="item-slot"></a>

Position of an item in the inventory. For a much simpler way of placing items on inventories you can use some formats:

#### **Format 1**

```yaml
<slot>:
  <item>
```

This will set an item on the slot 0.

```yaml
0:
  item: 
    id: BLACK_STAINED_GLASS_PANE
    name: " "
```

#### **Format 2**

```yaml
<slot1>;<slot2>;<slotN>:
  <item>
```

This will set the same item on slots 0, 8 and 16.

```yaml
0;8;16:
  item: 
    id: BLACK_STAINED_GLASS_PANE
    name: " "
```

#### **Format 3**

```yaml
<slot1>-<slotN>:
  <item>
```

This will set the same item from slots 0 to 8 (0, 1, 2, 3, 4, 5, 6, 7, 8).

```yaml
0-8:
  item: 
    id: BLACK_STAINED_GLASS_PANE
    name: " "
```

#### **Combining formats**

This will set the same item on slots 0 to 7, 9, and 17 to 26.

```yaml
0-7;9;17-26:
  item: 
    id: BLACK_STAINED_GLASS_PANE
    name: " "
```

## Item Slots Properties <a href="#item-slots-properties" id="item-slots-properties"></a>

On these item slots you can create your own items.

### **Item** <a href="#item" id="item"></a>

This is the item itself. Use the guide from [**HERE**](/codex/items-tutorial.md) to create them.

```yaml
0-8;9;17;18-26:
  item:
    id: "BLACK_STAINED_GLASS_PANE"
    name: " "
```

### **Open Inventory** <a href="#open-inventory" id="open-inventory"></a>

Add this option to open another created inventory when the player clicks on this item.

```yaml
36:
      item:
        id: ARROW
        name: "&7Go back"
      open_inventory: main_inventory
```

### **Click Actions** <a href="#click-actions" id="click-actions"></a>

Adds a list of actions to be executed when clicking on the item. List of actions [**HERE**](/codex/actions.md).

```yaml
40:
      item:
        id: BARRIER
        name: '&7Close'
      click_actions:
        - "message: &7Closing the menu."
        - "close_inventory"
```

### **Type: Category** <a href="#type-category" id="type-category"></a>

You can place a [**category display item**](https://ajneb97.gitbook.io/codex/pages/-MVws6vubyF4hYGFO3XV#id-1.-category) on the GUI by using the `type: category` option. If you do so, all other item properties are ignored. Format: `type: "category: <category_name>"`

```yaml
22:
   type: "category: regions"
```

### Type: Discovery <a href="#type-level" id="type-level"></a>

You can place a [**discovery display item**](https://ajneb97.gitbook.io/codex/pages/-MVws6vubyF4hYGFO3XV#id-2.-discovery-unlocked) on the GUI by using the `type: discovery` option. If you do so, all other item properties are ignored. Format: `type: "discovery: <discovery_id>"`

{% hint style="warning" %}
You can only use this type of item inside a `category_<category>` inventory.
{% endhint %}

```yaml
11:
  type: "discovery: shadow_swamp"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ajneb97.gitbook.io/codex/inventory-tutorial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
