Making trophies¶
A data pack can hand out trophies with the trophypedestals:set_trophy loot function, in a loot table, an
advancement reward or /loot. It makes a pedestal item a trophy recording subject, an achievement of kind (a kind a
mod registers, such as a quest mod's examplemod:quest with the quest as its subject), recorded as earned now; other
items are left as they are.
{
"type": "minecraft:item",
"name": "trophypedestals:cobblestone_pedestal",
"functions": [{"function": "trophypedestals:set_trophy", "kind": "examplemod:quest", "subject": "mypack:first_quest", "rarity": "epic"}]
}
| Field | Means |
|---|---|
kind |
the kind of achievement (required) |
subject |
what it records, as the kind names it (required) |
unlocker |
player (the default), team or server |
name |
the player's or team's name; without it, the entity the loot is for (the player opening a chest, for one) |
rarity |
its rank (epic, or a mod's namespace:path); without it, the kind's own for it (common if none) |
A trophy of a kind no installed mod registers (its mod was removed) still places and keeps its record, showing its subject's id and no icon.
Mob trophies are handed out the same way, as quest rewards or a sure drop from a boss, with the
trophypedestals:set_mob_trophy loot function. In a mob's own loot table it needs nothing: it shows the mob that died, as it
looked, slain by the player who last hurt it. Anywhere else (a chest, an advancement reward, /loot, a quest) it
names the mob:
{
"type": "minecraft:item",
"name": "trophypedestals:blackstone_pedestal",
"functions": [{"function": "trophypedestals:set_mob_trophy", "entity": "minecraft:wither", "rarity": "legendary"}]
}
| Field | Means |
|---|---|
entity |
the mob it shows; without it, the mob the loot is for (in a mob's loot table, the one that died), and anything else is left as it is |
look |
how the mob looks, in its own saved-data format, as /summon takes it ({"IsBaby": true}); without it, the look of the mob the loot is for if it's that kind of mob, otherwise as it spawns |
slayer |
who slew it; without it, the player who last hurt the mob the loot is for, or the player the loot is for |
rarity |
its rank (epic, a mod's namespace:path, or none); without it, by the mob's toughness, as mob_trophies.rank STRENGTH ranks them |
It's recorded as slain now, and items other than pedestals are left as they are. From a function or command block,
/trophypedestals mob_trophy <players> <entity> [pedestal] [rarity] gives each player one, slain by them, ranked by the
mob's toughness unless a rank is named. Mods use TrophyPedestals.createMob (from a living mob, look included, or a
kind of mob and a look) and mobRecord; rarity reads either kind of trophy's rank.