Wiki ArticleInformation neededData packs
Villager trade definition
Villager trades are stored as JSON files within a data pack in the path data/<namespace>/villager_trade. Despite their name, they also control the trades of wandering traders.
Villager trades are stored as JSON files within a data pack in the path data/<namespace>/villager_trade. Despite their name, they also control the trades of wandering traders.
JSON format
- [NBT Compound / JSON Object]: The root object.
- [NBT Compound / JSON Object] wants: The item needed for the trade (i.e. the price)
- A single item stack see Template:Nbt inherit/itemnoslot/template
- [NBT Compound / JSON Object] additional_wants: Secondary item needed for the trade
- Same format as [NBT Compound / JSON Object] wants
- [NBT Compound / JSON Object] gives: The item given by the trade
- A single item stack see Template:Nbt inherit/itemnoslot/template
- [NBT List / JSON Array] given_item_modifiers: Optional list of modifiers to apply to the item given by the trade
- [NBT Compound / JSON Object]: An inline item modifier. The
referencemodifier is not supported.
- [NBT Compound / JSON Object]: An inline item modifier. The
- [Int][Float][NBT Compound / JSON Object] max_uses: Optional number provider (defaults to
4, minimum1) determining the maximum amount of uses of this trade. - [Int][Float][NBT Compound / JSON Object] reputation_discount: Optional number provider (defaults to
0, minimum0) determining how much reputation (such as discounts and penalties) affect the count of [NBT Compound / JSON Object] wants. [more information needed] - [Int][Float][NBT Compound / JSON Object] xp: Optional number provider (defaults to
1, minimum0) determining how much xp the merchant gets when the trade is done. - [NBT List / JSON Array][NBT Compound / JSON Object] merchant_predicate: Optional predicate on the merchant that needs to pass for this trade to be offered. The
referencepredicate is not supported. - [String][NBT List / JSON Array] double_trade_price_enchantments: Optional — Any number of enchantment(s) (an [String] ID, or a [String] tag with
#, or an [NBT List / JSON Array] array containing [String] IDs) that when present after [NBT List / JSON Array] given_item_modifiers is run double the count of the [NBT Compound / JSON Object] wants item (when theadditional_trade_costitem component is present).
- [NBT Compound / JSON Object] wants: The item needed for the trade (i.e. the price)
History
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 26.1 | snap1 | Villager trades are now data-driven. | |||||
Navigation
| |||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||