mojira.dev
MC-273522

Mobs with CanPickUpLoot no longer pick up enchanted items after picking up an unenchanted item

The Bug

Mobs with CanPickUpLoot do not drop an item they are holding/wearing in favor of an enchanted item, unlike pre-1.20.5 behavior. For example, a zombie will not drop a netherite sword for a netherite sword enchanted with Sharpness. This also occurs with armor.

This bug was introduced in 24w09a.

Steps to Reproduce

  1. Summon a husk that can pick up loot:

    /summon minecraft:husk ~ ~ ~ {CanPickUpLoot:1b}
  2. Throw the husk a sword.

  3. Once the husk has picked up the sword, throw it a sword (of the same type) enchanted with Sharpness.

  4. ❌ Note how the husk does not pick up the enchanted sword.

[media]
  1. ✔ Attempting this in 1.20.4 shows the correct behavior, where the husk prefers the enchanted sword to the unenchanted sword.

[media]

Additional Notes

Related to MC-273450 and MC-193176.

Linked issues

Attachments

Comments 3

To clarify; this issue affects mobs which simply spawned with an item already as well as mobs which were given an item by a player. It is not required that the mob pick up the item from the player for the issue to occur.
Here, a zombie which spawned naturally with an iron sword on its own will not pick up an enchanted sword that I gave it:

[media]

Additionally, skeletons with this issue will never prioritize bows. As in, you could spawn one in holding a piece of dirt and nothing else and it will still refuse to pick up any bow dropped to it. as seen in the attached clip (1.21.1) I summoned two skeletons with CanPickUpItems set to true, with one holding a stone block and the other holding nothing. The one holding nothing picked up the bow, the one with the stone did not. 

[media]

Viradex

etanaratsastaja

Community Consensus

Platform

Important

Mob behaviour

24w09a, 1.21, 1.21.1 Release Candidate 1, 1.21.1, 24w33a, ..., 1.21.2 Release Candidate 1, 1.21.2 Release Candidate 2, 1.21.2, 24w44a, 1.21.3

24w45a

Retrieved