Trading is a game mechanic which allows the player to trade with NPC villagers. The player can either buy items using emeralds, or use items to buy emeralds.
Right clicking a villager will open the trading interface, which has one ore more offers of the villager. Villagers have different professions, which affect the offers they make. A blacksmith will only sell armour, tools and weapons, while a farmer will sell you various food items and tools.
The prices villagers ask are set, though not all villagers charge the same amounts for the same items. However, villagers will generate new offers, which could be the same item in larger or smaller quantities with a different price. But villagers will only generate a new offer when the last item they have on offer (rightmost item) has been traded once before.
Villagers only generate a new offer when the trade window is closed and they’ll emit purple particles for a few seconds. The newly generated offer could be either a new item or an item they were already selling, which will overwrite the old offer. This new offer could be worse, so it may take ages to get them to lower their price to your liking.
Blacksmith buys:
Coal: 16-23 for 1 emerald
Diamond: 4-5 for 1 emerald
Iron ingot: 8-9 for 1 emerald
Gold ingot: 8-9 for 1 emerald
Blacksmith sells:
Diamond axe: 1 for 9-11 emeralds
Diamond Hoe: 1 for 7 emeralds
Diamond Pickaxe: 1 for 10-11 emeralds
Diamond Spade: 1 for 7 emeralds
Diamond Sword: 1 for 12-13 emeralds
Iron axe: 1 for 6-7 emeralds
Iron Hoe: 1 for 4-5 emeralds
Iron Pickaxe: 1 for 7-8 emeralds
Iron Spade: 1 for 4-5 emeralds
Iron Sword: 1 for 7-10 emeralds
Iron helmet: 1 for 4-5 emeralds
Iron Chestplate: 1 for 10-13 emeralds
Iron Legs: 1 for 8-9 emeralds
Iron Boots: 1 for 4-5 emeralds
Chain helmet: 1 for 5-6 emeralds
Chain Chestplate: 1 for 11-14 emeralds
Chain Legs: 1 for 9-10 emeralds
Chain Boots: 1 for 5-6 emeralds
Diamond helmet: 1 for 7 emeralds
Diamond Chestplate: 1 for 16-18 emeralds
Diamond Legs: 1 for 11-13 emeralds
Diamond Boots: 1 for 7 emeralds
Farmer buys:
Cooked Fish: 9-12 for 1 emerald
Gold ingot: 8-9 for 1 emerald
Raw Chicken: 14-17 for 1 emerald
Wheat: 18-21 for 1 emerald
Wool: 14-21 for 1 emerald
Farmer sells:
Arrows: 5 for 1 emerald
Bread: 3-4 for 1 emerald
Cooked Chicken: 7-8 for 1 emerald
Cookies: 8-10 for 1 emerald
Flint: 2-3 for 1 emerald and 10 gravel
Flint and steel: 1 for 3 emeralds
Melon slice: 5-8 for 1 emerald
Shears: 1 for 3 emeralds
Librarian buys:
Book: 12-14 for 1 emerald
Paper: 19-29 for 1 emerald
Written book: 1 for 1 emerald
Gold ingot: 8-9 for 1 emerald
Librarian sells:
Bookshelf: 1 for 3 emeralds
Clock: 1 for 10-11 emeralds
Compass: 1 for 10-11 emeralds
Glass: 4-5 for 1 emerald
Priest buys:
Gold ingot: 8-9 for 1 emerald
Priest sells:
Bottle o’enchanting: 2-4 for 1 emerald
Raw Beef: 1 for 7-10 emeralds
Glowstone: 2-3 for 1 emerald
Redstone dust: 2-4 for 1 emerald
The Priest will also enchant your iron and diamond swords, axes, pickaxes and chestplates for 2-4 emeralds per item.
Butcher buys:
Gold ingot: 8-9 for 1 emerald
Raw Beef: 14-17 for 1 emerald
Raw Porkchop: 14-17 for 1 emerald
Coal: 16-23 for 1 emerald
Butcher sells:
Steak: 6-7 for 1 emerald
Cooked Porkchop: 6-7 for 1 emerald
Saddle: 6-7 for 1 emerald
Leather Cap: 1 for 2-3 emeralds
Leather Tunic: 1 for 4 emeralds
Leather Pants: 1 for 2-3 emeralds
Leather Boots: 1 for 2-3 emeralds