Villager Trades
Villager trades are data-driven JSON files introduced in Minecraft Java Edition 26.1 that define what individual trades a villager can offer and how they are grouped into trade sets per profession level. This system fully replaces the old hardcoded trade lists and lets data packs control everything about villager economies - what items are bought and sold, at what quantities, for how many uses, with what item modifier functions applied to the output, and under what conditions.
Overview
The trade system uses two file types that work together:
villager_trade- a single trade offer: inputs the villager wants, the output it gives, limits, and rewards.trade_set- a pool ofvillager_tradereferences that Minecraft samples from when a villager gains a level.
A villager profession's trade list is built from a stack of trade sets, one per level. Each time a villager levels up, Minecraft draws amount trades at random from the appropriate trade set.
File Structure
For the full JSON specification see:
Villager Trade
Creating a Trade
Use villagerTrade on your DataPack. Call wants and gives inside the block to set the required items - both accept an ItemArgument, an optional fixed count, and an optional component builder.
Item Slots
wants, gives, and additionalWants all follow the same shape: an item id, an optional stack size, and an optional block to set data components on the item.
Two-input trades use additionalWants for the second slot:
VillagerTrade Fields
All fields are optional except wants and gives, which must be set before the data pack is generated.
| Field | Type | Description |
|---|---|---|
additionalWants |
ItemStack? |
Second item slot the villager requests alongside wants. |
doubleTradePriceEnchantments |
InlinableList<EnchantmentOrTagArgument>? |
Enchantments on the player's item that double the trade cost. |
givenItemModifiers |
ItemModifierAsList? |
Item modifier functions applied to the output item before delivery. |
gives |
ItemStack? |
Item the villager offers in return. Required. |
maxUses |
NumberProvider? |
Maximum uses before the trade locks. Unlocks when the villager restocks. |
merchantPredicate |
PredicateCondition? |
Condition checked against the merchant entity; trade only appears when it passes. |
reputationDiscount |
NumberProvider? |
Price multiplier applied based on the player's village reputation. |
wants |
ItemStack? |
Primary item the villager requests. Required. |
xp |
NumberProvider? |
XP points awarded to the villager when the trade completes. |
Applying Item Modifiers to the Output
Use givenItemModifiers to run item modifier functions on the item the villager gives. This is how you add random enchantments, custom lore, or any other post-processing:
See Item Modifiers for all available functions.
Gating a Trade with a Predicate
merchantPredicate is a condition evaluated against the villager entity. The trade only appears in the merchant's offer list when the condition passes - useful for biome-locked or NBT-gated trades.
See Predicates for all available condition types.
Double-Price Enchantments
doubleTradePriceEnchantments lists enchantments that, when present on the player's traded-in item, cause the villager to charge twice as much. Vanilla uses this for the Curse of Binding and similar effects.
Trade Set
Creating a Trade Set
A TradeSet groups references to villager_trade files and controls how many are offered per level. Pass the list of trade references (returned by villagerTrade) and an amount provider:
Sampling with Tags
You can mix individual trade references with tag references in the same pool:
TradeSet Fields
| Field | Type | Description |
|---|---|---|
allowDuplicates |
Boolean? |
Whether the same trade can be drawn more than once per level-up. |
amount |
NumberProvider |
How many trades are drawn from this set when a villager levels up. |
randomSequence |
RandomSequenceArgument? |
Named random sequence for reproducible sampling. |
trades |
InlinableList<VillagerTradeOrTagArgument> |
Trade references or tags to sample from. |
Full Example: Custom Farmer Profession Level 1
See Also
- Item Modifiers - Apply functions to the item a villager gives
- Predicates - Gate trade availability via
merchantPredicate - Enchantments -
doubleTradePriceEnchantmentsand enchanting trade outputs - Tags - Group trades into reusable
villager_tradetags for trade sets - Loot Tables - Related data-driven item generation system
External Resources
- Minecraft Wiki: Villager trade definition
- Minecraft Wiki: Trade set definition
- Minecraft Wiki: Trading - How the vanilla trading system works
- Minecraft Wiki: Villager - Villager behavior, professions, and leveling
