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 26.2-snapshot-3

Players picking up items is handled in ItemEntity.playerTouch, whereas mobs picking up items is handled in Mob.aiStep. They both check for pickup delay, but only the former checks the item’s target (owner).

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, , 23w05a, 1.21.3, 24w45a, 26.1.2, 26.2 Snapshot 3

Retrieved