How to Reproduce - Observation 1:
Spawn a zombie with CanPickUpLoot set to 1b:
/summon minecraft:zombie ~ ~ ~ {CanPickUpLoot:1b}
Give the zombie a mace / trident.
After it picks up the mace / trident, give it a netherite axe, a highly coveted item by zombies that has more attack damage than the mace / trident.
Observed result:
It doesn't pick up the netherite axe.
How to Reproduce - Observation 2:
Spawn a zombie with CanPickUpLoot set to 1b:
/summon minecraft:zombie ~ ~ ~ {CanPickUpLoot:1b}
Give the zombie a stick, one of the least desirable items for zombies.
After it picks up the stick, give it a mace / trident.
Observed result:
It doesn't pick up the mace / trident.
Expected result:
Mobs should generally prefer weapons based on the melee attack damage that they deal.
Notes:
Mobs will replace most (if not all other weapons) with any sword, even if the sword deals less damage.
Related to MC-193176.