Talk:Drops

From Minecraft Wiki
Jump to: navigation, search

Rare drop code[edit source]

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:

EntityLiving.java:

public void onDeath(DamageSource par1DamageSource)
{
  Entity entity = par1DamageSource.getEntity(); // what killed the mob
  int i = 0;
  if (entity instanceof EntityPlayer) // if killed by player
  {
    i = EnchantmentHelper.getLootingModifier(((EntityPlayer)entity).inventory);
  }
  dropFewItems(recentlyHit > 0, i); // normal drops
  if (recentlyHit > 0)  // needs to be hit by player, but still get rare drops
  {                     // if killed by fire enchantment or something
    int j = rand.nextInt(200) - i; // smaller range (better rare drop chances) if player has Looting
    if (j < 5)                     // normal 1 in 40 (2.5%) chance
    {
      func_48085_j_(j > 0 ? 0 : 1);  // and 1 in 5 chance of an enchanted weapon, if possible
    }
  }
}

EntityPigZombie.java:

protected void dropFewItems(boolean par1, int par2)
{
  int i = rand.nextInt(2 + par2); // 0 or 1 drops, more possible if player has Looting
  for (int j = 0; j < i; j++)     // par1 is ignored, same drops if killed by player or mob grinder
  {
    dropItem(Item.rottenFlesh.shiftedIndex, 1);
  }
  i = rand.nextInt(2 + par2);
  for (int k = 0; k < i; k++)
  {
    dropItem(Item.goldNugget.shiftedIndex, 1);
  }
}

protected void func_48085_j_(int par1)
{
  if (par1 > 0)
  {                                                      // if drop is flagged as enchanted,
    ItemStack itemstack = new ItemStack(Item.swordGold); //  always produces a sword
    EnchantmentHelper.func_48441_a(rand, itemstack, 5);  // picks the enchantments somehow
    entityDropItem(itemstack, 0.0F);
  }
  else
  {
    int i = rand.nextInt(3); // if not enchanted, equal chances of all rare drops
    if (i == 0)
    {
      dropItem(Item.ingotGold.shiftedIndex, 1);
    }
    else if (i == 1)
    {
      dropItem(Item.swordGold.shiftedIndex, 1);
    }
    else if (i == 2)
    {
      dropItem(Item.helmetGold.shiftedIndex, 1);
    }
  }
}

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?[edit source]

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)


 Expand article — 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)

 Comment — 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)

 Expand (and rename) article — 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)

 Pro 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). Calinou - 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[edit source]

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 onDeath:
i is 200; j is between -200 and -1; func_48085_j_ is always called with parameter 1 (because j > 0 can't be true)
And inside func_48085_j_ 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 int j = rand.nextInt(200 - i);. So I expected Looting 100 swords to produce j 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?[edit source]

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

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

No Despawn[edit source]

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#Chunks. 87.152.83.170 17:22, 19 April 2012 (UTC)

Rare drop enchantments testing[edit source]

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.[edit source]

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[edit source]

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 5 + difficulty*random(0..5) 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[edit source]

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 rand(0, rand(0, 4)) 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)

Split?[edit source]

Currently, this page mainly documents the mechanics of mob drops, but then has some sections listing the drops for all mobs, blocks and entities tacked on the end. I recommend renaming this page to Mob drops and then either splitting the lists out to List of drops (or even drops, once this page is moved, and links are fixed), or keeping the list of mob drops and splitting the entity (or merge them with mob drops?) and block lists to Block drops and Entity drops, which would also allow for the mechanics of those types of drops to be documented (this page would then become a disambiguation page). MattTalk
Contribs
⎜ 07:11, 3 July 2014 (UTC)


 Agree. The latter option seems favorable, especially as (as far as I can tell) block drops lack a single overview article similar to this one. This article should be renamed entity drops, since there is virtually no difference between mobs and other entities. —F‌enhl 07:15, 3 July 2014 (UTC)

 Agree. I like the latter option as well. I think entity drops should remain separate, since their are different mechanics controlling them. Entity drops can then have a paragraph on mob drops with {{Main}} linking to the article. --KnightMiner (t|c) 16:30, 3 July 2014 (UTC)
I don't think the drop mechanics of immobs are different enough from mobs to require their own article. Could you provide an example of an immob whose drops behave fundamentally different from what is currently described here? —F‌enhl 18:02, 3 July 2014 (UTC)
If you look, mobs run off of common, uncommon, rare, and equipped. Other entities just drop one thing all the time (except boats). Most entities are actually more like blocks in the way their drops act. --KnightMiner (t|c) 18:08, 3 July 2014 (UTC)
That is true, but is there enough to have a separate page on entity drops? We can't have them with block drops (even though they act very similar), but if we have them with mob drops (or entity drops) then most of the page is dedicated to talking about mob drops with just a small section at the end talking about other entities, like what we have now. MattTalk
Contribs
⎜ 12:32, 4 July 2014 (UTC)
Not really, their drops are pretty straight forwards. But it does not really fit on either blocks or mobs. The article would be mainly about basic drop mechanics and link to the article on the more advance mechanics. --KnightMiner (t|c) 19:10, 4 July 2014 (UTC)
Well it would fit on mobs if it was renamed to entity drops. Behind the scenes, most immob drops are common drops. The mechanic is literally the same, while block drops have a completely different underlying mechanic that doesn't fit into either of the categories described for entities. —F‌enhl 01:05, 5 July 2014 (UTC)
Yeah, that might be the best place for it, if someone can right a good opening paragraph for it. --KnightMiner (t|c) 14:28, 5 July 2014 (UTC)

"Common" and "uncommon" drops[edit source]

The "common" and "uncommon" drops doesn't really match reality.

  • Magma Cube's magma cream drop without looting is a 25% chance of dropping 1 cream, which sounds like an "uncommon" drop. But it actually works as a −2–1 common drop plus the 0–L looting drop, where a −2 or −1 total is the same as 0. In other words, Looting I is 0–2 with a 25% chance of 1 and 12.5% of 2. Looting II is 0–3 with a 25% chance of 1, 16.67% of 2, and 8.33% of 3. Looting III is 0–4 with a 25% chance of 1, 18.75% of 2, 12.5% of 3, and 6.25% of 4.
  • Wither Skeleton's coal is similar, without looting is a 33.33% chance to drop 1. But it's actually working like a "common" drop with a −1–(1+L) range, so Looting I gives 25% chance of 1 and 25% of 2, Looting II gives 20% each of 0–3, and Looting III gives 16.67% each of 0–4.
  • Guardian's shard drop is a normal common drop. The non-rare raw fish drop is "uncommon" as described here, except instead of Looting working like Spider's eye drop it adjusts the single drop chance as (1+L)/(3+L). The crystals drop is worse, it's also (1+L)/(3+L) but only if the non-rare raw fish drop fails, so it works out to 2*(1+L)/((3+L)*(3+L)) which actually gives the best rate for Looting I!

So how do those fit in with this "common"/"uncommon" distinction? Anomie x (talk) 18:51, 5 July 2014 (UTC)

Rare drops (pocket)[edit source]

I play pocket edition, and I've seen rare drops (a carrot and a potato) lying on the ground, even though it wasn't a player kill. Has a simalar thing happened to anyone else? If so, the rare drops section should say that in pocket edition, rare drops can occur, even if it isn't a player kill.67.160.25.176 22:55, 4 March 2015 (UTC)

First check to may sure they came from the zombie. Also check other rare drops, as carrots and potatoes may not be rare drops in the pocket edition. If you can witness rare drops from a non-player kill from multiple mobs, it would be relevant to state. KnightMiner t/c 23:23, 4 March 2015 (UTC)
They must've come from the zombie because they were the first of their kind in the world I was playing. Also, carrots and potatoes are the only rare drops in pocket edition, if they are rare drops, so I can't test it on other rare drops.71.35.109.25 02:28, 5 March 2015 (UTC)
If they are the only rare drop, I would not conciser then enough of a test case, the code might simply define them as 2.5% drop rate rather than creating a rare drop function. KnightMiner t/c 02:55, 5 March 2015 (UTC)
I tested this on zombie pigmen in creative by spawning them from a high height. After a buch of attempts, I checked what was dropped. I saw a buch of gold ingots, a bunch of feathers, and a couple carrots/potatoes. Since they were killed by fall damage, it couldn't have been a player kill.71.35.109.25 15:33, 5 March 2015 (UTC)