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

Mob item pick up behavior is not distinct resulting in mobs constantly dropping and picking up items

    XMLWordPrintable

    Details

    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The rules for when a mob which can pick up items should pick up items are currently (method net.minecraft.entity.EntityLiving.updateEquipmentIfNeeded(EntityItem)):

      (itemToCheck.getDamage() < itemEquipped.getDamage()) OR (itemToCheck.hasTagCompound() AND NOT(itemEquipped.hasTagCompound()))
      

      Note: This shows the pseudo code with the fix for MC-44283.

      The problem here is that if the mob has a less damaged item equipped but the item to pick up has NBT data it will swap the equipped item. However, after that the item to pick up is less damaged and therefor the mob swaps them items again and so on.

      How to reproduce

      1. Summon a mob which can pick up items
        /summon husk ~ ~ ~ {CanPickUpLoot:1b}
        
      2. Set the mobGriefing gamerule to true if it is not already
        /gamerule mobGriefing true
        
      3. Throw a undamaged chestplate at the mob
        /give @p diamond_chestplate 1
        
      4. Throw a damaged chestplate (with NBT) at the mob
        /give @p diamond_chestplate{Damage:1} 1
        

      Note: Because of MC-44283 the item in step 3 has to be nearly broken while the item in step 4 has to be slightly damaged.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marcono1234 [Mod] Marcono1234
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: