mojira.dev
MC-193313

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

The bug

Mobs with CanPickUpLoot:1b do not have distinct rules for when to pick up items. Instead they constantly switch an undamaged item with a damaged item of the same type with additional NBT (e.g. enchantments, custom name, ...).

This is a clone of MC-113131, however it appears there were some versions including 1.15.2 where mobs did not prefer items with NBT. This might have been fixed by MC-174359.
The code analysis of MC-113131 is likely still relevant.

Results on a survival: https://www.reddit.com/r/Minecraft/comments/iao4p3/i_just_finished_afking_at_my_new_gold_farm_when_i/

Example videos:

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 an undamaged chestplate at the mob

    /give @p diamond_chestplate
  4. Throw a damaged chestplate (with NBT) at the mob

    /give @p diamond_chestplate{Enchantments:[{id:unbreaking,lvl:1s}],Damage:1}

    → ❌ The mob constantly swaps the items

Linked issues

Attachments

Comments 12

Please provide more details. Why exactly is this a bug, and how do you replicate it reliably? Simply linking to youtube videos is not enough.

Zombified Piglins that have CanPickUpLoot enable, can pick swords that are worse than their current ones, making them take swords infinitely.
That means that the 5 minutes counter to despawn can reset because they are on the ground for less than 2 seconds, u can crash a world or a server in a few hours.
More zombified Piglings dying, more swords on the ground, more noticeable this bug is.
Easy way to replicate this bug is with any gold farm that dont pick up swords.

Watch this part: [https://youtu.be/nMBYnGD8PbQ?t=514

If you dont have a system to take care of the swords, they are gonna be thousands, more zombified piglins dying in a single spot, more swords in that spot and everytime that a zombified piglin enter that spot is gonna take all at one, thats gonna happen over and over again.

Might be the same as MC-113131. Do you know if the unenchanted swords are damaged?

You are right Marcono1234, only happens when Item A has no damage/enchants and item B has enchants and damage.
This does not happen in 1.15.2, only in 1.16+

Can confirm that this is still an issue in 20w51a.

2 more comments

Affects 1.17

Also affects 1.19.40 I found a zombie after a desert temple trap exploded with extreme Decision Paralysis. See video.
Zombie unable to chose which block to hold

Still in 1.19.4, can confirm.

etanaratsastaja

Does this still occur in the latest version? I can't seem to reproduce it using the reproduction steps.

Seems fixed with the new item pick up behaviour, cant reproduce it anymore, nice!

BotPokey

(Unassigned)

Confirmed

Gameplay

Low

Mob behaviour

1.16.1, 20w28a, 20w29a, 20w30a, 1.16.2 Pre-release 1, ..., 1.19.2, 1.19.4 Pre-release 1, 1.19.4, 1.20.1, 1.20.4

24w45a

Retrieved