Skip to content

User Guide Variables

Adam Burdík edited this page Sep 28, 2026 · 1 revision

Variables

A variable represents one value pulled from an item.

variable "rarity" {
    source "pdc" key="rarity"
    lookup {
        "common" "<gray>Common"
        "uncommon" "<green>Uncommon"
        "rare" "<blue>Rare"
        "epic" "<light_purple><bold>Epic"
        "legendary" "<gold><bold>Legendary"
    }
    fallback "<gray>Unknown"
    default "<gray>Common"
}

Properties

Property Required Description
source yes Where the raw value comes from. pdc key="..." reads a PersistentDataContainer tag; computed fn="..." calls a registered Java function.
lookup no Maps a raw stored value to display text. Only useful for enum-like values.
default no Used when the PDC tag is missing entirely from the item.
fallback no Used when the PDC tag exists but its value isnt in lookup.

More examples

variable "item_level" {
    source "pdc" key="item_level"
    default "1"
}

variable "owner_name" {
    source "pdc" key="soulbound_owner"
    default "<gray>Unbound"
}

Using a variable in a template

A template references a variable with var:

var "rarity"
var "item_level" prefix="<gray>Item Level: "

prefix/suffix wrap the variable's rendered value with extra text at the point of use, without baking labels into the variable definition itself.

User Guide

Developer API

Plugin Integrations

Clone this wiki locally