Placeholders
AstralPets registers one root placeholder namespace with AstralCore (pets) and four chained ComplexPlaceholder types that only resolve once something registers an instance into the current placeholder container: pet, blueprint, rarity, and food. For the placeholder syntax itself (%a_b_c%, %a_{b_c}%, $e(...)) see Placeholders.
pets_* (root)
Resolved by PetsPlaceholder, registered globally on RootPlaceholderContainer — usable anywhere AstralCore evaluates a placeholder.
Placeholder | Type | Description |
|---|---|---|
| Optional<Pet> | The viewer's currently-selected pet, from |
| ItemProvider<Pet> | The viewer's active pets ( |
| ItemProvider<Pet> | Every pet the viewer owns ( |
| ItemProvider<PetBlueprint> | Every loaded pet blueprint ( |
%pets_blueprints% is checked before anything else, so it resolves in any context (console, non-player menus, …). equipped/actives/all additionally require context.context() to be a Player and that player's PetPlayerData to be loaded via SyncAPI.findData — either check failing makes the whole placeholder resolve to null.
pet_*
A Pet placeholder (namespace pet). Only resolves where something has registered a Pet instance into the container — see Chaining and context below.
Placeholder | Type | Description |
|---|---|---|
| UUID | The pet's unique id. |
| Component | The pet's current display name (set at creation, changeable via rename). |
| String | Plain-text serialization of |
| PetBlueprint | Chain into |
| ItemStack | The blueprint's |
| double | Current accumulated experience. |
| int | Current level. |
| double | Experience required to reach |
| PetInventory | Chain into |
| boolean |
|
| boolean |
|
| boolean? |
|
| boolean? |
|
| List<Component> | Rendered current-level effect lines — see Effect display sub-keys. |
| List<Component> / empty | Rendered next-level preview lines — see Effect display sub-keys. |
Example — blueprints/simple.yml uses the pet's own context inside its item template:
Effect display sub-keys
%pet_effects% renders one line per effect configured on the pet's blueprint, using each effect's display template (or its displayStatsMax template instead, when the effect is maxed for the pet's current level and displayStatsMax is set). Two placeholders are available inside that template:
%value%— the effect's cumulative value at the pet's current level.%maxValue%— the effect's cumulative value at the effect's ownmaxLevel.
Both are formatted with a thousands separator (space-grouped, up to 2 decimals — e.g. 12 345.67).
%pet_nextLevelEffects% renders a preview of the next level using each effect's next-level-display template with a single %value% bound to the effect's incremental value for level + 1 (not cumulative). Effects whose next-level value is 0 are skipped. The whole placeholder resolves to an empty component when the pet is already at its blueprint's max-level, or when every effect's next-level value is 0.
blueprint_*
A PetBlueprint placeholder (namespace blueprint). See Pet Blueprints for the blueprints/*.yml shape this reflects.
Placeholder | Type | Description |
|---|---|---|
| String | The blueprint's id (its |
| Component |
|
| ItemStack | The blueprint's |
| PetRarity | Chain into |
| int |
|
rarity_*
A PetRarity placeholder (namespace rarity), reached from blueprint_rarity/pet_blueprint_rarity.
Placeholder | Type | Description |
|---|---|---|
| String | The rarity id (e.g. |
| Component | The rarity's rendered display name (e.g. |
| TextColor | The rarity's configured color. |
The rarity's level-expression (the Crunch math expression that derives XP requirements) is not exposed as a placeholder.
food_*
A FoodBlueprint placeholder (namespace food). See Pet Food.
Placeholder | Type | Description |
|---|---|---|
| String | The food blueprint's id. |
| ItemStack | The food's |
| double | Experience granted to a pet fed this item. |
Chaining and context
Unlike pets, the pet/blueprint/rarity/food namespaces are not registered on RootPlaceholderContainer — they only resolve where the surrounding code has explicitly registered an instance into the placeholder container being evaluated. In practice that happens:
Inside a blueprint's own
item/entity.name/entity.sub-nametemplates, evaluated with thatPetregistered (see thesimple.ymlexample above).In command feedback —
/pets giveand/pets foodbuild a container fromAstralPaperAPI.createPlaceholderContainer(target)(giving%player_name%etc.) and register the resolved blueprint on top, sogive-success/give-food-successcan reference%player_name%and%blueprint_name%/%food_item_name%together:
In menus and other pet-related messages (pet added/removed/spawned/leveled-up, etc.), where the relevant
Petis registered before the message is sent.
Chains compose across namespaces: %blueprint_rarity_display% reads a blueprint's rarity display, and %pet_blueprint_rarity_id% walks pet → blueprint → rarity from a single Pet instance. Any *_item% key (pet_item, blueprint_item, food_item) resolves to an ItemStackPlaceholder — see Placeholders for its sub-keys.