Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-120578

Mobs that CanPickUpLoot ignore item "Owner"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w45a, Minecraft 17w45b, Minecraft 17w46a, Minecraft 17w48a, Minecraft 17w49a, Minecraft 17w49b, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w03b, Minecraft 18w07b, Minecraft 18w16a, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre4, Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13, Minecraft 18w31a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w44a, Minecraft 19w04a, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, 1.14.4, 19w40a, 19w46b, 1.15.2, 20w17a, 20w21a, 1.16 Pre-release 2, 1.16.1, 20w29a, 20w30a, 1.16.2 Pre-release 3, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w48a, 21w03a, 21w05b, 21w06a, 21w07a, 21w16a, 1.17, 1.17.1, 1.18.1, 1.18.2, 1.19, 1.19.2, 22w42a, 1.19.3, 23w05a
    • Confirmed
    • Commands, Mob behaviour
    • Low
    • Platform

      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.

        1. MC-120578.mp4
          4.64 MB
        2. MC-120578.png
          MC-120578.png
          851 kB

            Unassigned Unassigned
            tryashtar [Mod] tryashtar
            Votes:
            23 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: