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
Summon a husk that can pick up loot:
/summon minecraft:husk ~ ~ ~ {CanPickUpLoot:1b}
Throw the husk a sword.
Once the husk has picked up the sword, throw it a sword (of the same type) enchanted with Sharpness.
❌ Note how the husk does not pick up the enchanted sword.
✔ Attempting this in 1.20.4 shows the correct behavior, where the husk prefers the enchanted sword to the unenchanted sword.
Additional Notes
Linked issues
is duplicated by 1
relates to 2
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:
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]
Can confirm.