# loot-templates.yml

## `loot-templates.yml` — starter rewards for the GUI

`loot-templates.yml` ships pre-populated with a handful of common rewards (XP bottles, keys, an elytra, an economy payout, a LuckPerms rank grant, etc.). It's surfaced in the admin GUI's **`+ Add custom`** flow: pick **From template** in the entry-type Dialog, then choose a template from the second-stage Dialog's option list. Click **Add** to append it to the current loot pool.

You can extend the file to ship your own house "loot patterns" for later reuse. After editing, run `/tcpvc reload`.

### File location

```
plugins/TCP-VaultCrates/loot-templates.yml
```

### Top-level shape

```yaml
templates:
  <template-id>:
    label: "Human-readable label"
    description: "What this template does, shown in chat."
    entry: { ... a single LootEntry, same schema as crates.yml ... }
```

Each `template-id` is the stable identifier the GUI lists in the template-picker Dialog. Use lowercase letters, digits, `_`, and `-` only.

The `entry:` block is a literal loot entry — same schema as the `entries:` list under a crate's loot pool in `crates.yml`. Any entry type is allowed (`vanilla`, `command`, `key-reward`, `wild-spawner`).

### Built-in templates

| id                        | What it adds                                         |
| ------------------------- | ---------------------------------------------------- |
| `xp_bottle_4`             | 4 XP bottles per roll, weight 15                     |
| `give_xp_100`             | `/xp add {player} 100`, weight 10                    |
| `nether_star`             | One nether star, weight 2                            |
| `legendary_key`           | A Legendary crate key (requires a `legendary` crate) |
| `command_pay_1000`        | `eco give {player} 1000`, weight 10                  |
| `command_lp_user_donator` | 7d Donator+ via LuckPerms, weight 1, announced       |
| `diamond_block_stack`     | 64 diamond blocks, weight 1, announced               |
| `totem_of_undying`        | One totem, weight 3                                  |
| `elytra`                  | One elytra, weight 1, announced                      |

### Adding your own

Append to the `templates:` map. Example — a "Mythical Sword" template that grants a custom-named diamond sword with lore:

```yaml
templates:

  mythical_sword:
    label: "Mythical Sword"
    description: "Custom-named diamond sword with lore."
    entry:
      type: vanilla
      material: DIAMOND_SWORD
      amount: 1
      weight: 2
      display-name: "<gradient:gold:red><b>Mythical Sword</b></gradient>"
      lore:
        - "<gray>Forged in the heart of a dragon.</gray>"
      announce: true
```

### Validation

Templates that reference other content (a `crate-id` for `key-reward`, a `preset-id` for `wild-spawner`) are validated **at insert time**, not at load. If the referenced crate or preset is missing when an admin picks the template, they get a clear error in chat and the loot pool reopens with no change. This means it's safe to ship templates that reference optional content — they'll just refuse to apply until the content exists.

Templates with structurally invalid entries (bad material, missing required field) are logged with a warning at startup and skipped.

***

Next: **Configuring crates.yml →** · **The admin GUI →**


---

# 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://darkstarworks.gitbook.io/plugins/mc/tcp-documentation/tcp-vaultcrates/installation/loot-templates.yml.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.
