가이드
WorkflowSummon

Create custom villager trades with the /summon command

8 min read

Custom villager trades let you build shops, quest givers, and reward NPCs that sell anything for anything. The trades live in an Offers compound on a summoned villager, where each recipe pairs the items a player pays with the item they receive, plus limits like max uses and whether the trade grants experience.

가이드 결과

A /summon command for a villager whose trades, prices, and profession you define exactly.

관련 workflow 열기SummonBuilding custom villager trades

권장 경로

  1. Open the Summon module and choose villager.
  2. Set VillagerData with a profession, level, and biome type so the villager looks right.
  3. Add each recipe with a buy item (the price), an optional buyB second price, and a sell item.
  4. Set maxUses high and rewardExp to false so the trade does not lock or leak XP.
  5. Because these commands are long, paste the result into a command block.

Profession and appearance

A villager without a profession shows as an unemployed nitwit-style villager, so set VillagerData:{profession:"farmer",level:2,type:"plains"}. The profession changes the outfit badge, level sets the tier ring, and type sets the biome outfit like plains, desert, or snow.

Set level to 2 or higher so the villager does not look like a fresh novice, and give it a CustomName with CustomNameVisible:1 if it is a named shopkeeper.

  • profession sets the outfit (farmer, librarian, cleric, and so on).
  • type sets the biome look (plains, desert, savanna, snow, jungle, swamp, taiga).
  • level sets the tier badge from novice to master.

Writing a trade recipe

Each entry in Offers.Recipes has buy (the first cost), an optional buyB (a second cost), and sell (what the player receives). A simple trade of one emerald for sixteen wheat is {buy:{id:"emerald",count:1},sell:{id:"wheat",count:16}}. On Java 1.20.4 and older, use Count with a b suffix instead of count.

Add maxUses so the trade does not lock after a few uses (a large value like 9999999 keeps it effectively unlimited), and set rewardExp:false to stop the villager from dropping experience on every trade in a shop context.

  • buy is the price; buyB is an optional second price item.
  • sell is the item the player receives.
  • maxUses controls how many times the trade can be used before locking.

Multiple trades and command length

Offers.Recipes is a list, so add as many recipes as you like to build a full shop. Each recipe is independent, so you can mix emerald prices, item-for-item barters, and expensive multi-item deals.

Villager trade commands quickly exceed the 256-character chat limit. Paste the command into a command block, or for a large shop, place it in a datapack function so it is easy to edit and re-run.

Ship the copied artifact

Use this guide to produce the artifact a player or map maker will actually run: a copied command, ordered Project pack, or datapack resource. The final review should happen on that copied output, not only on the editable builder state.

When the workflow is version-sensitive, label the target version beside the command. When it uses selectors, scoreboards, bossbars, tags, loot tables, or project order, test those dependencies in a clean world before publishing the setup.

  • Copy from Output for one command and from Project for ordered packs.
  • Keep Java, Bedrock, and snapshot variants separate.
  • Test destructive selectors with harmless output first.
  • Update related presets when the guide becomes the canonical workflow.

관련 가이드 및 preset

FAQ

How do I summon a villager with a custom trade?

Add an Offers compound, for example /summon villager ~ ~ ~ {VillagerData:{profession:"farmer",level:2,type:"plains"},Offers:{Recipes:[{buy:{id:"emerald",count:1},sell:{id:"wheat",count:16},maxUses:9999999}]}}.

How do I stop the trade from locking?

Set maxUses to a large number like 9999999. The trade normally locks after a set number of uses until the villager restocks; a high maxUses keeps it available.

Can a trade cost two different items?

Yes. Add a buyB item alongside buy. The player then pays both the buy and buyB items to receive the sell item.

Why is my villager naked or a nitwit?

It has no profession set. Add VillagerData with a profession and a level of 1 or higher so it takes a job outfit instead of showing as unemployed.

Why does the command say it is too long?

Villager trade commands often pass 256 characters, which the chat bar rejects. Paste it into a command block, or use a datapack function for large shops.

When should this guide become a Project pack?

Use Project when the workflow needs more than one command, has setup and cleanup order, or must be edited again after testing. One-off commands can stay in Output.