Custom wandering trader trades
Since VillagerAPI 1.26.11.2, a villager pack can change what the wandering trader sells and buys: add trades, remove trades for any item, change how many trades it offers, add new pools or replace its trades entirely.
Where the file goes
Put one or more JSON files in villagers/wandering_trader/ inside your villager pack. Any file name works, and subfolders are fine. Without such a file the wandering trader is left exactly as vanilla makes it. New to villager packs? Start with the guide.
You don't have to write the file by hand: the villager pack generator has a Wandering Trader panel for every Minecraft version VillagerAPI supports, and it can load an existing pack to edit.
Example
{
"replace": false,
"remove": ["minecraft:pufferfish_bucket", "minecraft:nautilus_shell"],
"pools": {
"common": {
"amount": 6,
"trades": [
{ "wants": { "id": "minecraft:emerald", "count": 3 }, "gives": { "id": "minecraft:cherry_sapling" }, "max_uses": 8, "xp": 1 }
]
},
"uncommon": {
"replace": true,
"trades": [ ... ]
},
"mypack:festive": [
{ "wants": { "id": "minecraft:emerald", "count": 5 }, "gives": { "id": "minecraft:cake" }, "max_uses": 2, "xp": 1 }
]
}
}
This trader no longer sells pufferfish buckets or nautilus shells, offers six common trades including cherry saplings, picks its uncommon trades only from your list, and always sells cake.
| Key | What it does |
|---|---|
replace | true drops all of vanilla's wandering trader trades. Only the trades from villager packs are left. |
remove | A list of item IDs. Every wandering trader trade that sells or asks for one of these items is left out. |
pools | The pools the trader picks its trades from, by name. |
Trade pools
Each wandering trader picks a number of trades from every pool:
| Pool | 1.21.1 | 1.21.11 | 26.1.2 to 26.4 |
|---|---|---|---|
buying, the trader buys items | 2, only villager pack trades (vanilla has none outside the trade rebalance experiment) | 2 | 2 |
uncommon | 1 (2 with the trade rebalance experiment) | 2 | 2 |
common | 5 | 5 | 5 |
A pool is either a list of trades or an object with these keys:
| Key | What it does |
|---|---|
trades | Trades added to the pool, in the same format as villager trades: wants, gives, additional_wants, max_uses, xp, reputation_discount, given_item_modifiers and so on. |
amount | How many trades the trader picks from this pool. |
replace | true drops vanilla's trades from this pool only. |
Any other pool name, for example mypack:festive, makes a new pool. A new pool without an amount gives all of its trades to every wandering trader.
Several packs
Files are read in villager pack priority order. replace and remove from any pack apply, trades from all packs are added together, and the first pack that sets a pool's amount decides it.
Good to know
- A removed item also removes trades that other villager packs add for it.
- If a trade can't be made, for example a map with no structure nearby, the trader picks another one from the same pool instead.
- On 26.1.2 and newer a trade without
reputation_discountuses 0.05, like VillagerAPI's villager trades. removematches the items of the finished trade. Explorer maps areminecraft:filled_map, so use that ID to remove map trades.minecraft:maponly matches blank maps.- Pool names may also be written with the minecraft namespace, like
minecraft:common. The server log lists every pool a villager pack adds, so a misspelled vanilla pool is easy to spot. - The files are read when the world or server starts. Changes need a restart, not just
/reload. - Wandering trader trades that other mods add through vanilla's trade table (1.21.x) or trade tags (26.x) are kept, and
removeworks on them too. - Trade viewers such as Just Enough Resources don't show these changes.