Mojira Archive
MC-120578

Mobs that CanPickUpLoot ignore item "Owner"

The bug

Items with an Owner tag set to the name of a player cannot be picked up by other players, but can be picked up by mobs that can equip loot.

How to reproduce

/summon item ~ ~ ~ {Owner:[I;1,2,3,4],Item:{id:"cod",Count:1b}}

Ensure mob griefing is enabled (/gamerule mobGriefing true), and summon a mob that can pick up loot:

/summon zombie ~ ~ ~ {CanPickUpLoot:1b}

You'll notice the zombie pick up the fish that was not meant to be accessible by it.

Code analysis

Based on 1.12.2 decompiled using MCP 9.40

The method net.minecraft.entity.item.EntityItem.cannotPickup() only checks if the pickup delay is > 0, but could also not check the owner because the method has no entity parameter. See also MC-125496 for a possible pseudo code solution.