mojira.dev
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.

Linked issues

Attachments

Comments 11

 If it is on hard they aways can pick up anything. So if it is not on hard mode then it is a bug.😉

Can confirm in 20w48a.

Can confirm in 21w03a.

Can confirm in 21w05a.

Can confirm in 21w06a.

1 more comments

 Can confirm in 21w16a.

Can confirm in 1.17.1.

Can confirm in 1.18.1.

Can confirm in 1.18.2.

Can confirm in 1.19.

tryashtar

(Unassigned)

Confirmed

Platform

Low

Commands, Mob behaviour

CanPickUpLoot, item, item-entity

Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w45a, Minecraft 17w45b, ..., 22w42a, 1.19.3, 23w05a, 1.21.3, 24w45a

Retrieved