Trading



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

Functionality
Right-clicking on a villager will open a GUI allowing a player to trade with the villager. Villagers will make offers based on their profession, and will only make trades based on what offers they are making. Different offers may be viewed by pressing the left and right buttons next to the currently displayed offer. All offers involve emerald as a currency, and some item pertinent to the villager's profession. Trading allows the acquisition of uncommon items that would otherwise be fairly difficult to obtain, such as chainmail armor. It is also the only legitimate method of acquiring bottle o' enchanting in Survival mode.

A villager will never offer to buy/sell the same item at different prices or quantities (for example, no villager will offer to buy either 16 raw pork or 17 raw pork: there can only be one offer to buy raw pork). However, the quantities and prices may vary from villager to villager, and a villager's own quantities/prices may change when they generate new offers.

All villagers initially have only one offer to make. They can generate new offers when the last offer available (rightmost on their list of offers) has been traded at least once. Note that the trading GUI must be closed before a villager will generate a new offer. When they do, they become surrounded with purple and green particles for a moment. New offers may involve items a villager was already buying/selling: in this case, the newly generated offer will overwrite the previous one, allowing a villager's prices (or priest's enchantments) to change. Although there is no maximum limit on the number of offers an individual villager can make, they can only have one offer for each type of item they can trade. In addition, when a villager already has many offers, there is a high probability that a newly generated offer will be of an item they already offer: thus the old offer will be overwritten, and there will not be any new offer slot added to the villager.

Villagers will deactivate an offer if the offer has been used some number of times and it is not the villager's only offer. The chance of an offer's deactivation is random, but an offer must be used at least 3 times before it is eligible for deactivation. After an offer has been used 13 times, it is guaranteed to be deactivated if you close the interface after trading it (this is true even if all 13 trades have been done at once). Trading the last offer may activate an offer again.

Prior to the Pretty Scary Update (v1.4), it was possible to trade more than 13 times on a single offer because offers were not removed until the trading interface had closed. This meant you could buy an offer as many times as you could afford with one inventory. Currently, villagers can halt trading on a particular item once the conditions for deactivation have been met even if the trading window is still open. This can cause strange behavior in inventory when player is using shift and click when trading. At first it seems that all goods have been traded, but after taking an action in inventory the amount of emeralds and goods in user inventory changes. Once the trading window is closed and reopened, the offer will still be displayed, but red X's will indicate that the offer is no longer available. However, only one offer can be removed after the trading interface is closed: if you trade multiple offers beyond the limit, only the last one traded will be removed. In this way, an offer with more than 13 uses can be kept, and the game does not check offers for disabling until the offer is traded.

In addition, if an offer is the last offer available, it is never disabled even if its uses exceed 12. Once it is no longer the last offer, of course, it is eligible for being disabled. When an offer is disabled, it has the same particle effect as an offer being created.

Unfortunately, though, you cannot change what a villager will sell, so you will have to trade until all items are unlocked.

Possible offers


The following table lists the minimum and maximum offers that a villager will make when buying and selling items.

Generic Villager (green clothes)
''Note: The green Villager is only obtainable using /summon, server commands, mods, or third-party map editors on version 1.7.4 or lower. It was removed in the first snapshots for 1.8 when new villager professions were added. It doesn't spawn naturally, even when using a spawn egg.''

1.8 Trading Revamp
In 14w02a, Villager trading has been revamped:
 * Villagers now spawn with careers.
 * Trades are now specific to career, and are unlocked in tiers
 * Villager career is now displayed in trade GUI.
 * Buying/selling any of the available options can unlock new tiers/reactivate available options. This is opposed to having to trade the last offer.
 * An offer is guaranteed to reactivate available options (and unlock a tier, if some have not yet been unlocked) the first time it is traded. On subsequent attempts, it will only have a 20% chance of doing so.
 * New offers will no longer rewrite old ones. New offers are appended to the end of the villager's list.
 * Each tier consists of a defined set of trade offers, and the tiers are the same for any given career (see chart).
 * When a trade has deactivated, the red X will appear immediately and prevent further trading, instead of having to close and reopen the trading window.
 * Villagers now distinguish between damage values; so, different colors of wool CANNOT replace white wool, charcoal cannot be traded in place of coal, and damaged tools cannot be traded in place of fully repaired tools. NBT data, however, is still ignored, so the content of a written book does not matter.
 * Trading now gives experience, thus no bottle o' enchanting offer exists.
 * All villagers in your world before 14w02a+ will retain their previous trade offers, but will gain the new trading mechanics.

Different careers are assigned to each Villager (viewable in the trading GUI). For example, brown-robed Villagers can be Fletchers or Fishermen; Blacksmiths can be Armorers or Weapon Smiths; etc. Every Villager spawns with Tier 1 of their given career, which range from 2-4 initial unlocked trades (i.e. all Shepherds will spawn with only two options, buying wool and selling shears).

Completing any trade offer with a Villager may unlock a subsequent tier of new offers and reactivate old ones. This is guaranteed the first time you trade a particular offer, and also has a 20% chance of occurring with subsequent trades to that offer.

The full list of careers and tiers is listed below:

White Apron Villager (Butcher)


The green Villager is no longer obtainable, even using /summon, server commands, mods, or third-party map editors. Attempting to create one instead yields a Farmer.

The order of trades, including the order that they are unlocked, is the same for any given career of Villager. However, the prices and enchantments may vary between two Villagers of the same career.

Trivia

 * Right-clicking on a villager pauses that villager's pathfinding.
 * Right-clicking on a villager right after a killing blow is dealt will result in the player trading with a dead villager. The trade goes through without any problems.
 * You cannot trade with child villagers.
 * If you're not satisfied with the current trade offers, you can kill some of the villagers. The remaining villagers will start breeding again, resulting in possibly better offers. You can do this using environmental damage (fire, lava, TNT etc.) as not to aggravate the village's Iron Golem.
 * Gold armor is the only armor that cannot be traded for. (Butchers sell leather, and the blacksmith every other type.)
 * In the first Pre-release of the Beta 1.9 lost update, villagers had a "name bar" above their head similar to other players in multiplayer. Their name was "TESTIFICATE".

Prior to trading revamp

 * Charcoal can be sold as coal to blacksmiths and butchers.
 * Trading is currently the only legitimate way to get Bottles O' Enchanting without creative mode.
 * Gold Ingots are used as a fallback offer; any time a villager randomly selects none of its offers, it chooses to buy gold ingots instead. This is why gold is offered so rarely as a trade, and also why it is the green villager's only item.
 * It is possible, when trading for an Enchanted Book with a librarian, that the cost in emeralds exceeds 64. This only happens with books containing tier 5 enchantments.