Trading

The trading system is a gameplay mechanic that allows players to trade emeralds for items (and vice-versa) with villagers and wandering traders.

Mechanics
Pressing on an adult villager opens a GUI, allowing a player to trade with the villager. Villagers make offers based on their profession. All offers involve emeralds, as a currency, and some item pertinent to the villager's career. Trading allows the acquisition of uncommon items. It is also the only legitimate method of acquiring globe banner pattern, woodland and ocean explorer map in Survival mode.

Different professions are assigned to each villager, and are viewable by their appearance (based on profession overlay, not biome outfit) and in the trading GUI. For example, villagers wearing straw hats are farmers. Every villager spawns from level 1 of their given career, which can be identified by the badge they wear: stone for novice, iron for apprentice, gold for journeyman, emerald for expert, and diamond for master iron, gold, and diamond. Each level consists of a defined set of offers. They gain experience when trading with a player and level up when their experience bar is full. Then, they receive regeneration and become surrounded with purple and green particles for a few seconds. Each profession unlocks a pre-defined and finite set of offers.

Villagers deactivate an offer after the offer has been used some number of times. The chance of an offer's deactivation is different for each item (see tables below). When villagers work at their job site blocks, they activate their offers again, up to twice per day. When an offer is disabled, a red "X" appears in the trading interface, and the villager displays the same particle effect as an offer being created.

Villagers distinguish between data values, so damaged tools cannot be traded in place of fully repaired tools.

All villager trades reward the player with 3–6 experience, or 8–11 experience if the villager is willing to breed. Wandering trader trades don't reward any experience.

Economics
In Bedrock Edition 1.11.0, villagers have 8-10 trade slots. Some trade slots with multiple possible trades display only one trade; for example, farmer villagers have 4 potential trades in their first trade slot, so each trade has a $1/4$ chance to be chosen. Each trade can be used a maximum number of times, after which the trade becomes disabled. Once trades are disabled, villagers must work at their corresponding job site block to resupply their trades (e.g.: a toolsmith villager works at a smithing table). The more often players trade with the same trade slot, the more that slot's demand increases (although some trades with 0 price multipliers are not affected by demand). The Hero of the Village effect reduces trade prices, except trades which cost one emerald. When a player trades with a villager, both the player and the villager gain experience. A villager levels up when its experience bar becomes full, unlocking new trade tiers (while keeping their old trades) and changing their badge. Villagers have 5 levels:
 * Novice: Available from the start
 * Apprentice: Requires 10 experience points
 * Journeyman: Requires 60 experience points
 * Expert: Requires 160 experience points
 * Master: Requires 310 experience points

In Bedrock Edition, villagers not from a template world are converted into villager_v2 when updating to 1.11.0, however if a player has already traded with a villager at least once, they keep their old trades, but with the new gui. Since old trades don't give XP to villagers, they are unable to level up.

Nitwit (green coat)
Nitwits are green-coated villagers. They cannot trade; as a result, they offer no trades, nor can they change profession.

Unemployed (no overlay)
Villagers without profession overlays are unemployed and cannot trade. They wear biome outfits (e.g. unemployed plains villagers appear as plain brown robed villagers (like farmers did before Village and Pillage, but also wearing an iron badge.))

An unemployed villager gains a profession by being close to an unclaimed job sites block near a valid bed. For example, an unclaimed cartography table convert an unemployed villager into a cartographer) when the villager claims it.

Java Edition offers
A maximum of two trades are randomly selected at every tier.

Wandering trader sales


The wandering trader is available only in Bedrock Edition and Java Edition. Unlike other villagers, the wandering trader does not buy items in exchange for emeralds – it only sells items, using emeralds as a currency. Therefore, the top row (header) of the following table is how many emeralds the player needs to receive the items listed in the bottom row (content) of the table.

Java Edition sales
The wandering trader offers six random trades from the list below.

Bedrock Edition sales
In Bedrock Edition, wandering traders sell 6 random trades. Their trades are unaffected by demand.

Five of the random trades are shown in the table below:

The other random trade is shown below (these items are chosen for each wandering trader and always offered but only one of them):

Video
Video by slicedlime:

Trivia

 * Right-clicking on a villager or wandering trader pauses that villager's or wandering trader's pathfinding.
 * If a villager takes damage while trading, the trading GUI closes.
 * In Bedrock Edition, while inside the trading GUI, an emerald appears above the villager's head.