User:Thg2k5/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 or wandering trader opens a GUI, allowing a player to trade with the villager or wandering trader. Villagers make offers based on their profession trading either emeralds for items or items for emeralds. Wandering traders offer only to sell items for emeralds. All transactions involve emeralds.

A villager offers to buy or sell items pertinent to the villager's career. Trading with a villager is also the only legitimate method of acquiring the globe banner pattern and woodland and ocean explorer maps in Survival mode.

Different professions are assigned to each villager based on their job-site block. This profession is indicated by their appearance and in the trading interface. A villager's profession dictates the trading pool used to determine its trades. For example, villagers wearing straw hats are farmers, so their trades are based on the Farmer trade pool.

Villagers have five career levels that can be increased by trading with them. Each villager starts at the "novice" level. A villager's level can be seen in the trading GUI. The level can also be identified by the badge they wear: stone for a novice, iron for an apprentice, gold for a journeyman, emerald for expert, and diamond for master. When a villager levels up, it gains up to two new trades, along with keeping their old ones. A villager can gain experience when trading with a player and levels up when the villager's experience bar becomes full. When leveled up, a villager receives regeneration and becomes surrounded by purple and green particles for a few seconds. Each profession unlocks a pre-defined and finite set of offers.

Novice villagers who have not traded can lose their profession and change back into unemployed villagers. For example, if their claimed job site block is removed and no unclaimed job site block is available. Removing and then replacing a job site block can alter the trades offered, and a villager with no experience will reset its trades every so often. Once a player trades with a villager, the villager keeps its profession forever, locking its offered trades.

Villagers deactivate an offer after the offer has been used some 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.

All villager trades reward the player with 3–6 experience, or 8–11 experience if the villager is willing to breed. Wandering trader trades also reward some player experience.

Economics
$$, villagers can have a maximum of 10 trades. Each level unlocks a maximum of two new trades. If a level can pull from more than two trades, the two offered trades are chosen randomly from the set.

$$, villagers have 8–10 trade slots. Some 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.

The price of an item rises and falls with demand. An item that was traded gets a price increase when resupplied. If a player does not trade for a higher-priced item, the price is reduced the next time villager resupplies. Demand is tracked per item, not per villager, so a villager can offer a higher-priced trade for a single item while other items are cheaper. Trades that have a price multiplier of 0 are not affected by demand. The Hero of the Village effect reduces trade prices, except for trades that cost one emerald.

Villagers who were previously zombie villagers that were cured by a player also reduce their prices for trades. To cure a zombie villager, you must splash it with a splash potion of weakness and then feed it a golden apple. this will often drop prices to the lowest possible amount wanted (or cost if you are buying).

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:

Nitwit
Nitwits are green-coated villagers. They cannot trade, nor can they change profession. If the player attempts to trade with a nitwit $$, the nitwit grunts and shakes its head.

Unemployed
Villagers without profession overlays are unemployed and cannot trade. They wear biome outfits without a profession overlay. An unemployed villager gains a profession by being close to an unclaimed job site block near a valid bed. For example, an unclaimed cartography table will convert an unemployed villager into a cartographer when the villager claims it. If a player attempts to trade with an unemployed villager, the villager will grunt and shake its head.

Armorer


Jobsite Block: Blast Furnace


 * Java Edition

Butcher
Jobsite Block: Smoker


 * Java Edition

Cartographer
Jobsite Block: Cartography Table


 * Java Edition

Cleric


Jobsite Block: Brewing Stand


 * Java Edition

Farmer


Jobsite Block: Composter


 * Java Edition

Fisherman


Jobsite Block: Barrel


 * Java Edition

Fletcher
Jobsite Block: Fletching Table


 * Java Edition

Leatherworker


Jobsite Block: Cauldron


 * Java Edition

Librarian


Jobsite Block: Lectern


 * Java Edition

Mason


Jobsite Block: Stonecutter


 * Java Edition

Shepherd
Jobsite Block: Loom


 * Java Edition

Toolsmith
Jobsite Block: Smithing Table


 * Java Edition

Weaponsmith


Jobsite Block: Grindstone


 * Java Edition

Wandering trader sales


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 leftmost column of the following tables is how many emeralds the player needs to receive the items listed in the middle column of the table.

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

The other random trade is chosen from the table below. It is always the wandering trader's final trade offer.

Bedrock Edition sales
$$, 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.
 * $$, while inside the trading GUI, an emerald appears above the villager's or wandering trader's head.