mojira.dev
MC-49509

Custom loots do not drop when mob is not killed by a player

I am making a tower defense map, and i want the mobs to drop custom loots.
The problem is that they drop only their basic loots when they are not killed directly by the player.

To check this, try :
/summon Sheep ~ ~1 ~ {Equipment:[{Count:1,id:258},{},{Count:1,id:304},{},{}],Attributes:[{Name:generic.maxHealth,Base:1}],DropChances:[1.0f,0f,1.0f,0f,0f]}

(all in one line)

If you kill the sheep with a sword, you will get the custom loots. But if you kill it with /kill, a dispenser, a wolf, etc, you will only get the regular loots.

EDIT : Of course, when a mob is not killed by a player, he will drop, assuming the gamerule doMobLoot is set to true. I have tested this in 1.5.2, 1.6.4, 1.7.4 and 14w08a. This bug was already in 1.7.4.

Comments 2

In survival gameplay, when the "DropChances" tag is at or below 1, this indicates the item being held was 'naturally spawned' along with the mob (for example, zombies wearing armor). Durability values on tools will be randomized when the item is dropped.

When the tag is set to any value above 1, this indicates the mob picked up items off the ground, and thus should be dropped no matter what upon their death, and their durability values should not be randomized.

So your command instead will need to have a DropChances value greater than 1 (defaults to 2.0 when a mob manually picks up an item). You should also be using the alphabetical IDs for items/blocks, as numerical is no longer supported:

/summon Sheep ~ ~1 ~ {Equipment:[{Count:1,id:minecraft:iron_axe},{},{Count:1,id:minecraft:chainmail_leggings},{},{}],Attributes:[{Name:generic.maxHealth,Base:1}],DropChances:[2.0f,0f,2.0f,0f,0f]}

As well, the "doTileDrops" is unrelated, and refers to blocks being broken, not mobs being killed. "doMobLoot" will need to be set to true, of course.

Thanks a lot !
I didn't know the "DropChances" tag can be set to a higher value than 1 : for me it was linked to a percentage. I still think this is a small bug, but thanks to you that's not really important now.
This topic can be set to resolved.

Batary

(Unassigned)

Unconfirmed

custom, drop, loot

Minecraft 1.7.4, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a

Retrieved