Talk:Drops

Rare drop code
Does anyone know what the chance of getting a rare drop is? In my newest save, started in 1.2.3, I've killed between 50 to 100 each skeletons and zombies, and only received a single rare drop (iron ignot). I don't think my grinder system would effect it (hole in the wall I attack them through). Anyone know? Raiu tree 05:30, 5 March 2012 (UTC)
 * The chance is small enough that trying to determine it statistically would be extremely tedious; you'd have to kill hundreds, if not thousands, of mobs to obtain accurate numbers. Fortunately, MCP was just updated for 1.2.3, so it's possible to obtain mostly-comprehensible source code. The relevant bits:


 * Skeletons drop 0 to (2 plus Looting modifier) each of arrows and bones, only rare drop is a bow. Zombies drop (0-2) + (0-Looting modifier) rotten flesh, and iron swords are never enchanted. I believe the highest Looting modifier is 3, which only increases the chance of a rare drop to 2.538%, and doesn't affect which or how many you get. -- Orthotope 08:07, 5 March 2012 (UTC)
 * Wow, thank you! So then it looks like 1 in 40 without enchantments, unless I'm (very likely) reading it wrong. Good Work! Raiu tree 21:14, 5 March 2012 (UTC)

Everyone seems to be complaining about getting very few rare drops. I seem to be experiencing quite the opposite.

Discuss other drops and orbs?
What do you think of expanding this article to cover non-rare drops and experience, or rather, all the effects of mobs' deaths? —kpreid 13:08, 6 March 2012 (UTC)
 * — I haven't seen an article on the general properties of non-rare drops. I think that all of these would have some useful commonalities for a single article (they're all entities, they all appear on death, and they each need a discussion of their probability distribution). —kpreid 13:08, 6 March 2012 (UTC)
 * — I could add the drop behavior for all mobs, wouldn't be too hard. The rare drops are distinct on a technical level, though: all mobs use the dropFewItems function, but only zombies, skeletons, and zombie pigmen use the new rare drop function. On the other hand, spiders only drop eyes when killed by a player, which is more similar to the rare drop behavior. -- Orthotope 21:02, 6 March 2012 (UTC)
 * — It will be nice to have an article about all mob drops (both rare and non-rare). I would see it as something like this. --mgr 12:04, 8 March 2012 (UTC)
 * Could be nice to have a page with all mob drops, also telling if they drop when the mobs are killed by the environment (most "older" mob drops do). C ali nou - talk × contribs » 12:25, 8 March 2012 (UTC)


 * I have data on drops (and a few other things of note) at User:Orthotope/mobs. I didn't bother making it pretty; it's not intended to appear on an article in this form. Let me know if any parts are hard to understand - the spider eye code is a bit hairy. -- Orthotope 09:00, 9 March 2012 (UTC)
 * Updated with effective ranges at normal levels of Looting, and the type of probability distribution. For some mobs, such as squid and blazes, Looting increases the range of the random number generated, so the distribution is still linear (i.e., all numbers have equal probabilities). For others such as creepers, Looting causes a second random number to be generated, resulting in a triangular distribution (biased toward the middle, like rolling a pair of dice). -- Orthotope 20:33, 10 March 2012 (UTC)

OK, there seems to be a mild consensus, so I'll go ahead and edit the article. —kpreid 12:02, 10 March 2012 (UTC)

Edit done, move done. I'll now update links to the article. —kpreid 13:10, 10 March 2012 (UTC)

Looting
I hereby confirm that looting does not add more per mob, but simply increase the CHANCE of it being dropped. This also increases the chance of the item being enchanted. This was tested with Looting Level 100 to make results more clear and responsive, but looting I through III should still behave the same way, just have less effect (it's looting 100 after all). Out of 5 bows, all 5 were enchanted. Same with all 29 gold swords. 4 Bane of Arthropods I, 1 Bane of Arthropods II, 2 Bane of Arthropods III, 2 Fire Aspect 1, 4 Smite II, 4 Smite III, 4 Sharpness I, 3 Sharpness II, and 2 Looting I. Some had 2 enchantments. With this confirmed data I will edit the page as needed. Funky3000 22:03, 6 March 2012 (UTC)


 * I've repeated your test and got similar results :). According to the source code, you can get the same enchantments as from the Enchantment Table when you choose cost 5. Few times I got two enchantments on a Golden Sword. --mgr 11:24, 8 March 2012 (UTC)


 * This bothers me, because it seems to contradict what the code says. Did you get any of the other rare drops from zombie pigmen, or just enchanted swords? -- Orthotope 21:19, 8 March 2012 (UTC)


 * It seems right to me. I've tested drops with Looting level 200. This means that inside :
 * is 200;  is between -200 and -1;   is always called with parameter 1 (because   can't be true)
 * And inside  this part will be executed:

ItemStack itemstack = new ItemStack(Item.swordGold); EnchantmentHelper.func_48441_a(rand, itemstack, 5); entityDropItem(itemstack, 0.0F);
 * which always gives us Golden Sword enchanted with a random spell that costs 5 lvls. --mgr 21:57, 8 March 2012 (UTC)


 * Okay, I was being an idiot, kept misreading the line as . So I expected Looting 100 swords to produce   in the range 0 - 100, rather than -100 - 99. This makes non-hacked Looting more useful than I had originally calculated: 4% chance of  rare drop with Looting III. -- Orthotope 01:58, 9 March 2012 (UTC)

Normal > Common?
I think "normal" drops should be called "common", anyone agrees with that? C ali nou - talk × contribs » 00:12, 14 March 2012 (UTC)


 * Sounds good to me. --mgr 13:58, 14 March 2012 (UTC)

No Despawn
i was playing on a map and i went to a spot i died 6 hours ago and my stuff was there Killrbladez 10:21, 18 April 2012 (UTC)
 * The 5 minute timer of the drops and other items only counts if you (or another player on multiplayer maps) are "near" the items. Otherwise the chunks are not loaded into memory and remain in the state as you died. 80.134.13.56 11:02, 18 April 2012 (UTC)

ok but how many chunks do i need to be away from where i died? Killrbladez 11:31, 19 April 2012 (UTC)
 * 81 @ render distance "far". See World. 87.152.83.170 17:22, 19 April 2012 (UTC)

Rare drop enchantments testing
I've written the code below to get possible enchantments for rare item drops. It enchants golden sword and bow 1 million times with a random enchantment that costs 5 levels and prints out the results. Tested on v1.3.1.

public static void main(String[] args) {    // required for proper initialization AchievementList.init; process(Item.swordGold, 5, 1000000); process(Item.bow, 5, 1000000); } public static void process(Item item, int cost, int tries) {    // create a stack with one item ItemStack itemstack = new ItemStack(item); // enchant the stack a few times Random rand = new Random; for (int i=0; i<tries; i++) EnchantmentHelper.addRandomEnchantment(rand, itemstack, cost); // extract enchantment names List list = itemstack.getItemNameandInformation; list.remove(0); // name // unique and sort list = new ArrayList(new HashSet(list)); Collections.sort(list); // print out System.out.println; System.out.println(item.getItemDisplayName(itemstack)); for (int i=0; i<list.size; i++) System.out.println(" "+list.get(i)); }

Results:
 * Golden Sword
 * Bane of Arthropods I
 * Bane of Arthropods II
 * Fire Aspect I
 * Knockback I
 * Looting I
 * Sharpness I
 * Sharpness II
 * Smite I
 * Smite II


 * Bow
 * Power I

--mgr 15:13, 4 August 2012 (UTC)


 * -- Guades 23:28, 11 August 2012 (GMT +1)
 * This is incorrect atleast on multiplayer because before the Enchanting nerf(1.3) I have had items of higher ranks(specifically Smite III) than the above dropped.
 * So... are you saying that it isn't true in SMP v1.3.1, or in previous versions? --mgr 17:13, 12 August 2012 (UTC)


 * It seems to me that 5 xp levels on gold tools should yield up to 35 modified levels, (5+1+22)1.25=35 which should give the potential for any enchantment below V. This implies to me that:
 * A) The page lists a bogus array of enchantments
 * B) The xp level of 5 is wrong (though even 1 would be higher than the supplied list)
 * C) It does not follow the normal enchanting rules
 * D) The normal enchanting rules as listed are incorrect
 * I do admit though that after killing about a hundred zombie pigmen with a maxed out sword, I saw no deviation from the list. Cultist O 10:58, 17 September 2012 (UTC)


 * Digging deeper (thanks Orthotope), it appears that D was, but is no longer true. the proper math is (I believe) (22/2+1+5)*1.15=20, which matches the pages list. Sorry to have brought this up in what appears to have been the wrong place. Cultist O 22:43, 17 September 2012 (UTC)

Stronger enchaments added.
I got a bow with unbreacking II and another with power III. The latest update added more powerful enchantments and should reflect that. --Shadow1033 20:40, 1 January 2013 (UTC)

Enchanted Drops
I don't know what the formula actually is, but it's certainly not the same as an enchant table with 5 levels. That will never get you anything but Power I on a bow, yet I've gotten bow drops with Power I-III, Punch I-II, and even one that had Fire I. Ira 01:55, 22 January 2013 (UTC)
 * You're right. Before 1.4.6 enchantment cost was always 5 levels. Since 1.4.6 the cost is  levels. That gives costs: 5–15 on normal difficulty, and 5–35 on hard. (On easy equipment is never enchanted.) --mgr 11:25, 22 January 2013 (UTC)

Dropped item damage
The formula for the damage of dropped tools/weapons/armor is:


 * maxDamage - rand(0, rand(0, maxDamage - 24))

The result is capped at maxDamage - 25 if it is greater. Note that new items have a damage value of 0, and they break once they exceed maxDamage. (rand(a, b) returns an evenly-distributed random integer between a and b inclusive here.) This has several consequences:


 * Due to the cap, items will always have at least 25 durability/uses remaining; this is also by far the most common outcome.
 * Less-damaged items are increasingly rare the better the condition they're in. I believe the nested rand calls result in a logarithmic distribution.
 * In general, items will have a minimum damage of 26. The exception is gold tools, which will have exactly 25 uses remaining.

Also, this completely replaces the previous damage value of the item. I haven't tested it, but in theory it might be possible to 'repair' nearly-broken items by giving them to zombies and hoping they drop again when killed. -- Orthotope 09:33, 7 March 2013 (UTC)
 * I may be a little rusty on my statistics, but I'd be extremely surprised if that was a logarithmic distribution. Without doing the math, I am pretty sure it is parabolic, but I'd believe hyperbolic.  --Mental Mouse 11:53, 7 March 2013 (UTC)


 * Did some testing, and graphing damage value vs frequency has a very nice regression of the form -k*log(x) + c. R2 = 0.99994, which is about as good as you can get with real data. I don't have a good explanation for why it's logarithmic, though when working out  by hand I noticed I was summing the inverses of successive natural numbers. For example, the chance of getting 0 is ⅕ * (1 + ½ + ⅓ + ¼ + ⅕); the chance of getting 1 is ⅕ * (½ + ⅓ + ¼ + ⅕); the chance of getting 2 is ⅕ * (⅓ + ¼ + ⅕), etc.. -- Orthotope 09:39, 8 March 2013 (UTC)
 * Funky, an infinite series... I recall that the integral of (y=1/x) is also ln(x).  I still don't quite get it, but now I can at least believe it.  --Mental Mouse 14:35, 8 March 2013 (UTC)