Adding your own cards
Cards, sets, rarities and packs in datapack JSON: every field, loot, automatic cards and an example add-on.
Everything players collect is datapack JSON, so a modpack or another mod can add cards, sets, rarities and packs without any code. Put the files under data/<your namespace>/tradingcards/:
| Folder | One file per |
|---|---|
rarity/ |
rarity tier |
set/ |
set |
card/ |
card |
pack/ |
kind of booster pack |
The file’s path is its id: data/mypack/tradingcards/card/grizzly_bear.json is the card mypack:grizzly_bear. A reference without a namespace ("set": "wild_friends", "rarity": "gold") looks in your own namespace first, then Trading Cards’ built-in ones, so your cards can use the built-in rarities, or even go in the built-in sets.
Use /reload to try changes and /tradingcards problems to see what’s wrong. A bad file is skipped and reported, never a crash. Cards for mobs that aren’t installed are skipped quietly, so one add-on can cover an optional mod.
An example: a set for Alex’s Mobs
A set, data/alexsmobs_cards/tradingcards/set/wild_friends.json:
{
"name": "Wild Friends",
"color": "#C77D2E",
"order": 10,
"symbol": "alexsmobs_cards:textures/set_symbol/wild_friends.png",
"icon": "minecraft:honeycomb",
"rewards": {
"items": [{"item": "minecraft:emerald", "count": 16}, {"item": "minecraft:golden_apple", "count": 2}],
"experience": 100
}
}
A card, data/alexsmobs_cards/tradingcards/card/grizzly_bear.json (only entity, set and rarity are required):
{
"entity": "alexsmobs:grizzly_bear",
"set": "wild_friends",
"rarity": "copper",
"number": 1,
"flavor": "Steals honey, naps in the sun, swipes at anything that wakes it."
}
A pack, data/alexsmobs_cards/tradingcards/pack/wild_friends.json:
{
"name": "Wild Friends Booster",
"color": "#8A5A22",
"sets": ["wild_friends"],
"slots": [
{"count": 3, "rarities": {"copper": 100, "iron": 30}},
{"count": 1, "rarities": {"gold": 80, "diamond": 2}}
],
"foil_chance": 0.05,
"wandering_trader": {"price": 6}
}
Card fields
| Field | Default | |
|---|---|---|
entity |
required | The mob, e.g. "alexsmobs:grizzly_bear" (no namespace means minecraft). Things that aren’t mobs work too: minecraft:mannequin for a player, minecraft:block_display and minecraft:item_display for a block or an item (see below). |
set |
required | The set it belongs to. |
rarity |
required | Its rarity. |
number |
next free | Collector number in the set (shown as 012/048). Duplicates are renumbered and reported. |
name |
the mob’s name | Text, or {"translate": "key", "fallback": "Text"}. |
flavor |
lang key card.<namespace>.<path>.flavor |
Flavour text; none if neither exists. |
stats |
Health, Attack, Height | Up to 3 {"label": "Bite", "value": "4"} to show instead, or false for no stats panel (the flavour text gets the room, up to six lines). Cards of things that aren’t alive have none unless they give their own. |
drop_chance |
the rarity’s | Chance per player kill (0 to 1), before the config multiplier and Looting. |
drops |
true | false: the mob never drops it (a pack-only card). |
in_packs |
true | false: never in booster packs (a drop-only card). |
nbt |
none | SNBT for the mob on the card, e.g. "{IsBaby:1b}" or a variant, as a string or a JSON object. |
match |
any of its mob | SNBT the dying mob must have for the card to drop, e.g. "{variant:\"minecraft:calico\"}". For variant cards. |
equipment |
none | {"mainhand": "minecraft:bow", "head": "minecraft:carved_pumpkin"} (also offhand, chest, legs, feet, body). |
scale |
1 | Bigger or smaller than the automatic fit. |
y_offset |
0 | Moves the model up (+) or down (-), in card pixels. |
yaw |
30 | Which way the mob faces, in degrees (0 is straight at you). |
art |
live 3D model | A texture to show instead, e.g. "mypack:textures/card/art/bear.png" (any square size). |
frame |
the rarity’s | A frame texture for this card only (96 x 134). |
backdrop |
its set’s | The scenery behind the mob: overworld, night, nether, the_end, deep_waters, bosses, or a texture id (82 x 61). |
enabled |
true | false removes a card an earlier datapack added under the same id. |
Players, blocks and items
From 1.0.1, a card can show a player, a block or an item instead of a mob. A player goes on a mannequin (Minecraft 1.21.11 and later here), wearing their skin from profile:
{"entity": "minecraft:mannequin", "set": "players", "rarity": "netherite", "name": "Steve", "nbt": {"profile": {"name": "Steve"}}, "stats": false, "drops": false}
Blocks and items go on display entities, with the same NBT as the summon command:
{"entity": "minecraft:block_display", "set": "blocks", "rarity": "diamond", "nbt": {"block_state": {"Name": "minecraft:diamond_block"}}}
{"entity": "minecraft:item_display", "set": "blocks", "rarity": "gold", "nbt": {"item": {"id": "minecraft:emerald", "count": 1}}}
The block or item stands in the middle of the card at the size of a block, and a transformation in the NBT still applies, to turn or stretch it. Display entities never die, so their cards come from booster packs. A mannequin can be broken, so give player cards "drops": false, or any mannequin a player breaks could drop one. Give these cards a name, since they have no name of their own worth showing.
Set fields
name, color ("#RRGGBB"), order (lower first), symbol (a 16 x 16 texture), icon (an item, used when there’s no symbol texture), season ({"from": "10-01", "to": "11-07"}: its cards only drop between those dates) and rewards: items ([{"item": ..., "count": ...}]), experience (points) and function (a datapack function run as the player, for anything else). All optional. A resource pack can add <namespace>:textures/card/backdrop/<set path>.png (82 x 61) as the scenery behind the set’s mobs.
Rarity fields
name, color, order (its place on the ladder: built-in Copper 0 to Netherite 4), drop_chance (the default for its cards), frame (a texture), shard_value (Card Shards a card trades in for, default 1) and craft_cost (shards to make one at the Card Shop; 0 means it can’t be made). With no frame, the game looks for <namespace>:textures/card/frame/<path>.png, then tints a plain frame with the rarity’s colour, so a new rarity works without any art.
Pack fields
nameandcolor(the wrapper colour).sets: the sets it draws from (empty means every set).slots: each{"count": n, "rarities": {rarity: weight}}. If a slot asks for a rarity the pack’s sets don’t have, it gives the nearest lower rarity that has cards.foil_chance: per card, default 0.04.unique: no card twice in one pack while there are others (default true).featured: the card whose mob stands in the pack’s window, e.g."overworld/creeper"; without it, the pack’s rarest card.art: a texture for the whole pack, replacing the built-in wrapper.wandering_trader:{"price": emeralds, "rare": false}; leave it out and traders don’t sell it.shop:{"shards": 30, "emeralds": 6}, what the Card Shop sells it for; leave either out and it isn’t sold that way.season:{"from": "10-01", "to": "11-07"}, only found in chests, sold by traders and the shop between those dates.
Putting packs in loot
On NeoForge, packs go into chests through global loot modifiers of type tradingcards:add_pack:
{
"type": "tradingcards:add_pack",
"conditions": [{"condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/jungle_temple"}],
"pack": "alexsmobs_cards:wild_friends",
"chance": 0.5,
"count": 1
}
List the file in data/neoforge/loot_modifiers/global_loot_modifiers.json ({"replace": false, "entries": [...]}). The built-in ones are in data/tradingcards/loot_modifiers/: override a file with the same path to change it. A pack whose cards aren’t installed is never handed out, in loot or by traders.
Automatic cards
With autoCards on (the default), every mob without a card file gets one when the datapacks load, in a set per mod (tradingcards:auto/<mod id>) named after the mod. Its rarity follows the mob’s health: under 21 Copper, 21 Iron, 40 Gold, 80 Diamond, 150 or more Netherite. It gets scenery to match: the sea for water mobs, the End for End-sounding ones, the boss ruins for the toughest, the Nether for fire-proof ones, and the Overworld by night or day for the rest.
Write a set file with an automatic set’s id to rename or recolour it or give it a reward; write a real card for a mob and its automatic one disappears.