Trading



The Trading system is a gameplay mechanic that allows Players to trade Emeralds for Items with NPC Villagers.

Information
As of 12w21a, right-clicking a villager will allow a player to trade with them. Villagers will make offers based on their profession, and will only make trades based on whatever offers they are making. Different offers may be viewed by pressing the left and right buttons next to the currently displayed offer. Most offers involve Emerald as a currency, and some item pertinent to the villager's profession.

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 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 to change. Although there is likely no maximum limit on the number of offers an individual villager can make, they can only have one offer per each 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.

Right clicking on a villager pauses that villager's pathfinding and opens up the trading window.

Charcoal can be sold as coal to blacksmiths and butchers.

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

''Note: Prices are the result of in-game testing and may be inaccurate. Verification needed.''

History
Before the Adventure Update, Notch once answered some questions about an idea he had, NPC Villages, where he revealed some thoughts about them:
 * If you treat the Villagers well (giving them items), they'll give you items back.
 * If you treat the Villagers badly (attacking/killing them), they'll try to do the same to you (feature added with Iron Golems).
 * Raiding chests will anger the owners of the town/chest and they will attack.

On May 21, 2012, Jeb released a screenshot of himself testing the Trading System. The image shows a GUI with buying and selling areas. The bottom area allows the player to sell various items for currency, whereas the top area uses this currency to purchase items. A possible way to buy them would be to put these currencies in the left slot, where the chicken is, and you can scroll through items for the right slot to take the item you choose once you click on it. The player may use the arrow buttons to scroll through a Villager's inventory and select the desired item. Jeb also mentioned that this may be an end to non-renewable resources, supposedly as most can be bought for some price from NPCs. In the image, a red currency item can be seen that was later revealed in snapshot 12w21a as the Emerald.

An ore block can be seen in the background which was later revealed in snapshot 12w21a to be a new Emerald Ore.

With the implementation of the trading system, most or all resources become "renewable" since nonrenewable resources can be traded from Villagers.

Bugs
In 12w21a 1.3 pre-release: Trading with villagers has a bug where submiting emeralds into the villagers inventory by right clicking will not give the option to trade: