Talk:Trading

Ore


I don't think there is actually a new ore block, but I'm not sure. The image of that block (in the inventory) looks very similar to the smooth stone block, but there seems to be little specks as shown in the enlarged file image. - Asterick6 (talk) 06:07, 22 May 2012 (UTC)


 * That's what an ore block is. It's an overlay on a smoothstone image. Joe4429 06:08, 22 May 2012 (UTC)


 * (I know what an ore block is). Ok then this isn't a real image, and I don't think there is an actual ore block for the coin. - Asterick6 (talk) 06:13, 22 May 2012 (UTC)


 * It's in the top-right corner of the image. I created this out of what I can see. Joe4429 06:22, 22 May 2012 (UTC)


 * Ah I see it now. Interesting. - Asterick6 (talk) 06:36, 22 May 2012 (UTC)


 * Wait maybe this isn't a new ore, but just a new texture for the redstone ore. If there's a new gravel texture, then there might be a new redstone ore texture. We should just wait until more info is released... - Asterick6 (talk) 06:48, 22 May 2012 (UTC)
 * Here's an enhanced screenshot btw. - Asterick6 (talk) 21:43, 22 May 2012 (UTC)


 * I'm under the impression it's either a new texture, an ore he made just for testing, or something which may or may not be related to the trading system. In the case of testing, it'd drop coins just so he knows how the game drops them. I honestly wouldn't like an ore that drops acceptable coins or being able to personally craft coins which a Villager would accept. If money worked like that... Well. If it's crafted from some new gem, maybe it'd make sense, but you'd still have to craft it. The same picture shows 20 raw chickens gets a coin. MegaScience 09:52, 22 May 2012 (UTC)


 * Btw for the other comment about the trade file: I just copied that from the Villager article. You gotta remove that one too then. - Asterick6 (talk) 21:01, 22 May 2012 (UTC)

Chicken clarity
Although it says 1 coin for twenty chickens i bet it is similar to how if you put 64 wood blocks the output on the crafting table still says 4 planks, and you just press it 64 times or shift-click.It basically means you get 64 sets of four, so chicken would go 20 groups of 1.


 * I suspect similarly. Until we're sure of anything, we shouldn't put like "This equals that." or "This ends up as that." I might have added something similar, sorry if I did. Coins might stack to different amounts... Who knows? MegaScience 19:21, 22 May 2012 (UTC)


 * I just spawned around 100 villagers and tried to trade with them. First thing I realized is that most have only one Item in their Inventory, and only few had the possibility to trade 2. Then, I saw that ONE sold me Bottles o' Enchanting, meaning they are now avaliable in Survival Mode. Next thing to mention is that the Prices may differ (2 villagers both sold diamond Chestplates, one for 16, one for 17 Emeralds), and that the price system does not make much sense (4 diamonds for 1 Emerald WUT? never gonna do that). Librarians usually buy Paper/Books and sell Bookshelves.
 * --JayTie


 * You can even trade for chain armors (among all the iron and diamond tools and armors the game has) with blacksmiths. Also only the priests (purple clothes) can give you bottles o' enchanting. However, I noted that the prices aren't always the same from one villager to another.
 * --Pauolo 17:15, 24 May 2012 (UTC)

More Trade Get!
After trading, I noticed the villager had a purple swirly particle effect. The villager then had more options available for trading. So apparently, by trading with a particular villager, you can gain favor and open up more items to trade with that one villager with eight trades maximum. --108.76.103.35 16:44, 24 May 2012 (UTC)


 * That's right, but sometimes it requires more trading than only one to access to new options (maybe a bug, it seems this snapshot is quite laggy and has problems with map loading).
 * --Pauolo 17:01, 24 May 2012 (UTC)

Trading info on Villager article
I added trading info to the Villager article before I knew this article existed. I included a table which includes the quantities villagers buy/sell items and their prices, and I also included a chart of 55 test offers made by each villager class. I'm not sure how to merge that into this article, as some of the information here seems outdated or missing, but I don't think overwriting those parts of this article is necessarily a good idea. If anyone wants to make the merge when more is known about trading, feel free to do so. Just avoid throwing out data from either article :p --WolfieMario 21:09, 24 May 2012 (UTC)

I'm doing the trade data on this article. I'll go ahead and merge your findings with mine, and remove the table from the Villager page. (I'll leave the picture there for now; that's nifty.)

...Oh, I haven't been paying attention to professions! I'll add the gold ingots to other professions, thanks. I'm merging by taking the min and max from each. I'm going to keep the table format here, but if someone wants to consolidate the formatting down the line, that'd be fine. --Zeta0134 22:40, 24 May 2012 (UTC)

I'm going to bring the Trading text from Villager over to the Trading page, and replace it on the Villager page with a link. That should eliminate the redundancy and let us maintain it in one place.

--Zeta0134 22:49, 24 May 2012 (UTC)

EDIT: All done. Check to make sure I didn't butcher anything; it looks correct to me. --Zeta0134 22:53, 24 May 2012 (UTC)


 * You omitted some data (specifically, larger price ranges I found). I also re-added my observation chart, as there's currently nothing indicating how rare or common various offers are. --WolfieMario 23:13, 24 May 2012 (UTC)


 * Ayaaa, I updated my list in notepad++ but didn't transfer to the wiki. My bad, but looks like you fixed it. This page is certainly coming together. :D Most of the prices have stabilized for my testing; if anything, I think the only deviations will be in the blacksmith. --Zeta0134 23:25, 24 May 2012 (UTC)

pricing is a joke
i do hope this gets made more reasonable at official release, i mean damn, 4-5 diamonds/8-9 iron for a single Em and a compass costs 10 Em? sheeeeeeet. 96.61.162.71 04:21, 25 May 2012 (UTC)

You can also sell (renewable) wool at the rate of 20/1, and buy diamond gear for as little as 7 Em. There does not appear to be any kind of internal value to the items, I mean, a compass costs more than a diamond helmet.2.109.200.145 15:51, 25 May 2012 (UTC)Anonymus


 * I agree about diamonds, but 1 stack of logs gets you 3 Em if you cook them into charcoal so you can get lots of Ems cheaply. 78.150.199.100 13:54, 27 May 2012 (UTC)


 * They buy paper. One can make a huge automatic sugar cane farm for that. 4 stacks of sugar cane buy a diamond pickaxe, or a stack of cooked meat. 17,5 stacks of sugar cane buy a full diamond armor set. 2 inventories and a half buy Bottle o' Enchanting for lvl 50. --88.173.92.54 06:40, 29 May 2012 (UTC)

"villager" class villager
Can anyone find out if the villager (green robes, don't naturally spawn) has anything to sell, and if so, what?
 * It always only buys 8-9 gold ingots per emerald, and has no other offers. I put this information up before, but it seems it's been removed - it seems anything that does not normally occur in vanilla tends to get removed from this wiki :/ --WolfieMario 14:09, 25 May 2012 (UTC)

Will Obsidian be renewable?
You could buy Redstone and pour lava onto it, but is that a bug that might be fixed some time? 78.150.199.100 13:37, 27 May 2012 (UTC)

Obsidian is renewable. Since iron is renewable, so is a bucket, when 4 flowing lava meet they make still lava, and since water is renewable, pour water on the still lava to make obsidian. 71.46.222.254 14:15, 1 June 2012 (UTC)


 * The thing with the lava doesn't work anymore since a few versions. --☺ Sven R.I.P. Donna Summer 15:35, 1 June 2012 (UTC)

You could abuse nether portals for unlimited obsidian, also. OverPortal A to NetherPortal A. NetherPortal A is autoconstructed. NetherPortal B to OverPortal B. OverPortal B is autoconstructed. Harvest OverPortal B. Return to nether through OverPortal A.  Return to Overworld through NetherPortal B.  OverPortal B is autoconstructed. Harvest OverPortal B. Repeat. Since diamond picks are no longer limited, this method of harvesting obsidian is not limited. --99.44.177.77 19:25, 4 June 2012 (UTC)

Will Lapis Lazuli be renewable?
Lapis Lazuli does not appear anywhere so I guess that is still non-renewable. 78.150.199.100 13:49, 27 May 2012 (UTC)

Price Information On all Items
Putting forward the idea to have item/block summary box (usually in the top right of a items page)have a new row added for example |cost = 1:8-10 (1 emerald for 8 to 10 of said item) So that when your on the items page you can see its costs 176.251.34.210 11:17, 28 May 2012 (UTC)

Villager Trading - Multipart Trades
The new trading system allows for multipart trades; 2 items go in (usually one of them Emerald), one item comes out. So far, I'm only seeing the PRIEST use this for applying enchantments. I'm presently building up a list of the options. So far, all enchantments that I've seen are level II of various things on tools and armor. --Zeta0134 14:35, 31 May 2012 (UTC)

Edit: There's the mentioned gravel trade with a blacksmith: 10 gravel and 1 Emerald for 2-3 Flint. No clue why anyone would actually do this of course. I'm also noticing a pattern with the enchantments; it seems to be a random set of enchantments, but the cost is always 2-4 emeralds. My guess is the level is always constant, maybe level 20? (That would make logical sense, requiring the player to get level 30 enchantments on their own.) More testing is needed, but I have to go to work now. Here's my list so far; if someone wants to continue and put this in the wiki, have at. This is bound to be very incomplete.

Enchants (priest) Iron Axe -> 4 -> Unbreaking II - Efficiency II Iron Axe -> 3 -> Unbreaking III Iron Pickaxe -> 2 -> Fortune I

Iron Chestplate -> 2-4 -> Fire Protection II Iron Chestplate -> 4 -> Projectile Protection III

Diamond Axe -> 4 -> Unbreaking II Diamond Pickaxe -> 2 -> Efficiency III

Diamond Chestplate -> 3 -> Protection II

Sells (priest) Eye of Emerald (1) -> 7 - 10

Buys (Librarian) Written Book -> 1

Sells (Librarian) Watch -> 10

Sells (Blacksmith) Arrow (5) -> 1

Converts (Blacksmith) Gravel (10) -> 1 -> Flint (2-3)

Buys (Farmer) Fish (9) -> 1 --Zeta0134 14:51, 31 May 2012 (UTC)


 * Are you sure that's what you got on a diamond axe? I made the same trade, and I got an axe with Unbreaking III and Efficiency III... Which would suggest that 1) These trades are just as random as actual enchanting, or 2) It's dependent on your level: I was in Creative mode, which automatically gives you maximum enchantability. ~GorgeousTaylor


 * The enchantments are random using level 5-19. (What that actually means is sort of up in the air, since enchantments were also scaled back to max level 30 with the update.) WolfieMario is doing disassembly of the code and filling in exact values, so the article should be completely accurate by the end of the day. To answer your question, yes the items will get different enchantments randomly, but it's not based on the player's level. --Zeta0134 17:24, 31 May 2012 (UTC)

Code analysis of 12w22a villager trading
Sorry, I didn't feel like making 275 trades again, so I instead decided to peek at the code :p For 12w22a, the villager class is. appears to be the method behind generating offers, and conveniently lists all offers. is the item class and  is the block class. Ctrl+Clicking in Eclipse makes it easy to find out what each offer is.

At the end of the method, it's revealed that the method is capable of adding multiple offers at once, but all calls to the method only request one new offer to generate. In addition, if no potential offers are generated, a default offer of buying gold ingots is generated - this is why the unused villager will only request gold ingots.

The method  called in the offer-generating method makes a new buy offer, while calls to   make new sell offers.

All buy offers are in exchange for 1 emerald. The quantity of item bought is derived from the contents of the  hashmap defined in the static section at the bottom. If no definition exists for an item in this hashmap, the quantity defaults to 1. If the first Integer in the pair of Integers of  (as defined in the static section) is greater than or equal to the second, then that is the amount which will be used for the stack quantity bought. Otherwise, the stack amount will range anywhere between the two integers (note that it can be as low as the minimum value, but only as high as the maximum value minus one, due to how  means coal is always bought in stacks of 16-23.

For sale offers, the stack value is determined in an identical manner, using the  hashmap (also defined in the static block at the bottom). However, the hashmap has negative values defined for some items. If this happens, the quantity is used (negated of course, so it is positive) for the item stack sold, and the cost in emeralds is 1. Otherwise, the quantity is the cost in emeralds and the item stack sold is 1. Therefore, it is impossible (with the current code) for a generated offer to have multiple emeralds in exchange for multiple items. Note that for negative values, the first Integer is actually the negation of the upper bound, and the second is the negation of one less than the lower bound.

For help understanding the  hashmap entries:   means flint and steel, in exchange for exactly 3 emeralds (remember that the second number is the upper bound plus one, so the actual range is [3,4), or [3,3], aka simply 3).   is bread, sold in stacks of 3-4 (consistent with observed values).

The probability of a given offer being a potential offer is equal to the float value passed to  or. However, the actual probability of getting this offer is less: first all potential offers are selected, and one offer will be selected at random out of these. Nevertheless, this is helpful at gauging the relative rarity of any given offer, so I will add information such as "rare" or "common" to the article itself.

Note that there are also special offers, not generated with the  or   methods.

The first unique offer is a farmer offer: at 50% chance, the following code will add a new potential offer:. This is 10 gravel and an emerald, in exchange for flint in quantities of 2-3.

The other special offers are by priests. Specifically, a 10% chance of each enchantment offer being a potential offer. Items which can be enchanted are iron and diamond swords, iron and diamond chestplates, iron and diamond hatchets, and iron and diamond pickaxes. The line  is repeated for each of these items (assuming that particular item will be a potential offer, which I already mentioned is a 10% chance). The request is the item in question and 2-4 emeralds, and the sold item is, to my understanding, the same item enchanted with a level of 5-19.

Here is the entire code of  (the villager class, containing all information on trade offers):

I'll be updating the article shortly. --WolfieMario 16:56, 31 May 2012 (UTC)


 * Neat! I updated the Enchantment area for Priests based on the code. I'm not sure if you should be posting the code here, but as the Bukkit team (employed by Mojang) regularly posts disassembled code in their public github, I'm sure it's not a problem.


 * I suppose the trickiest part will be matching up the items, as those garbage class names aren't helping us any. --Zeta0134 17:18, 31 May 2012 (UTC)


 * If I'm reading the code correctly, any time a villager's list is empty (which is rare, but possible) the game adds the offer for Gold Ingots to the list as a fallback. This explains why the green villager only ever offers that trade, and also why it rarely shows up for all the other professions. This also means that the Farmer can very rarely offer it; I'll update the list. --Zeta0134 17:36, 31 May 2012 (UTC)


 * Yes, you're reading it right. I find it amusing that the potential probability of a librarian offering to buy a written book is 1.3, or 130%. That means it can never default to gold ingot for a librarian, until Jeb fixes this. Kind of annoying since Written Book slightly throws off all other actual probabilities by always being in the draw for a new offer, but I suppose written book is a rather good deal, eh? :p --WolfieMario 20:26, 31 May 2012 (UTC)

Put it on pastebin for the sake of the page loading faster. Unrelated: how did you decompile/deobfuscate it? C ali nou - talk × contribs » 20:28, 31 May 2012 (UTC)
 * Oh, cool, I wasn't aware of that site. I didn't want to paste it inline, but I didn't know of any good alternatives.


 * Anyways, I used JAD (JAva Decompiler) to decompile all classes after extracting them from minecraft.jar (it lets you use the wildcard modifier, e.g. "*.class", to decompile all classes in a directory). I didn't deobfuscate it, as you can tell by the horrendously messy and difficult-to-read code. I did my best to understand it, however. See this post for how I figure out which classes to look in.


 * In this case, I noticed the text "Offers" in the NBT structure of a villager that has offers (using NBTedit on a schematic), and figured that must exist as a raw string somewhere in the code. Doing an Eclipse file search for that confirmed my notion - the only class with that string is EntityVillager, aka the class I had pasted here. --WolfieMario 20:44, 31 May 2012 (UTC)

Fun fact: there are 4 unused buy offers, found in the hashmap that indicates costs:

- 3 enderpearls for an emerald

- 34-47 seeds for an emerald (I would love this offer considering how many I have after using stacks of bonemeal in the dark to get loads of flowers :p)

- 30-37 melon seeds for an emerald

- 30-37 pumpkin seeds for an emerald

There are, of course, also the no-longer-used priest offers to buy eyes of ender and rotten flesh.

Finally, the following curiosity:

- the offer for arrows, but the greater value is the first slot. This means that the code will not bother generating a random number, and instead only offer 5 arrows. If the numbers are flipped, it's 6-19 arrows, and if the failsafe didn't exist it would have been 5-18 arrows (which isn't too far off). Hopefully Jeb fixes this one; it would be nice to buy arrows if you don't have a skeleton grinder. --WolfieMario 20:56, 31 May 2012 (UTC)

Enchantments - Multiple of one Item?
Can someone verify whether a Priest will offer to enchant the same item multiple times? Does it check to see if the enchantments are the same, or would a new offer to enchant, say, an Iron Pickaxe with Unbreaking III replace the previous offer of an Iron Pickaxe with Efficiency II?

Unlocking more offers
What is the most efficient way to unlock more trading offers in a survival game? Should I build a large nursing facility and pick vilagers out using a wagon until I get the right offer? --217.128.124.56 14:52, 4 June 2012 (UTC)
 * I'm not sure what you mean by a wagon, but it seems tedious to make a new villager for every offer you want. You'd have to search for that specific villager every time you want to make that trade, and that sound like more trouble to me than it's worth. Also, villagers breed until their population is 0.35x the number of "houses" (read: doors with ceilings). On a survival server I play on, I actually made a building with the 5 types of villagers each in a slot. Come 1.3, I'll just trade with them until all their offers are available. There's a 12-stack sugarcane farm nearby, which can be readily turned to paper and sold to librarians for roughly a half stack of emeralds each harvest. As long as you are trading the rightmost offer, new offers should get generated until all the common offers have been generated. If you're lucky, by the time only rare offers remain, the rightmost will be an offer to sell items (as emeralds are easy to farm from several materials). Fortunately, the worst deal, 5 diamonds for an emerald, belongs to the blacksmith, who's very likely to generate a new offer every time - thus you'd likely only need to spend 5 diamonds once. Remember, villagers can only generate a new offer after you've closed the trading interface. --WolfieMario 15:30, 4 June 2012 (UTC)