How to Summon Customized Minecraft Villagers - dummies

How to Summon Customized Minecraft Villagers

By Jacob Cordeiro

One interesting use of entity data tags is the ability to customize villagers in Minecraft. Villagers are mobs that can trade items with players, and their trading options are usually generated randomly. Sometimes players will use certain simplified in-game commands to spawn random villagers such as: /summon villager.

However, you can also use external editors to customize a summoned villager with data tags, allowing you to specify exactly what the villager will to buy and sell. Players can adjust the commands (or code) that spawns villagers and basically control the entire economy of their village. This power allows you to designate certain vendors as the primary traders of certain item types, encourage trade between one another, and even create a unique shopping precinct for other players on your Minecraft server.

For example, you can make a villager trade an emerald for a diamond, red wool for blue wool, gold nuggets for enchanted armor, a wooden sword and a stone sword for an iron sword, and so on.

This is useful for creating shopkeepers with very specific settings, such as a villager who accepts lapis lazuli in different quantities in exchange for weapons and potions. You can give villagers as many trading options as you want, and they can trade absolutely any item you want. You can also open distinct shops like armories, bakeries, and even carpentry supply stores!

Custom Villager Trades

To make villagers trade what you want in Minecraft, use the following tags to customize your command code to specify their individual buy / sell settings. The tag is written this way:

{Offers:
 {
     Recipes:
  [
   <recipe1>
   <recipe2>
   ...
   <last recipe>
  ]
 }
}

Each recipe is a compound that can contain the following tags:

  • buy: An item compound representing the item that the villager wants to buy.

  • buyB: An item compound representing another item that the villager wants to buy. (Villagers sometimes want two different items in exchange for their wares.)

  • maxUses: The maximum number of times the trade can be used. This can be set to an extremely large number if you want the trade to be nearly infinitely available.

  • rewardExp: Equal to 1 (by default) if you gain experience points by using this trade. Otherwise, equal to 0.

  • sell: An item compound representing the item that the villager wants to sell.

  • uses: The number of times the trade has been used. This defaults to 0, so you generally can keep it as is.

Thus, for example, you could program a villager by entering the following command:

summon Villager ~ ~ ~ {Offers:{Recipes:[{
 buy:{id:diamond,Count:50},
 sell:{id:diamond_sword,tag:{ench:[{id:16,
  lvl:6}]}}
 },{
 buy:{id:planks},buyB:{id:emerald},
 sell:{id:iron_block},maxUses:999999,
  rewardExp:0}
]}}

This command creates a villager with two different offers:

  • The first trade allows you to spend 50 diamonds (buy:{id:diamond,Count:50}) in exchange for a diamond sword with the Sharpness VI enchantment.(sell:{id:diamond_sword,tag:{ench:[{id:16,lvl:6}]}})

  • The second trade allows you to spend wooden planks and an emerald (buy:{id:planks},buyB:{id:emerald}) in exchange for an iron block (sell:{id:iron_block}), but does not grant experience points (rewardExp:0) — this trade also almost never expires, because it can be used 999999 times (maxUses:999999).

Understanding how to customize these tags will give you the full ability to dictate what each summoned villager will buy, sell, or trade for. Now that you know how to customize your own villagers, learn how to trade with a villager in Minecraft.