Affects Version/s: Minecraft 1.7.4, Minecraft 1.7.9, Minecraft 16w42a, Minecraft 1.11.2, Minecraft 1.12.2, Minecraft 18w05a, Minecraft 1.13.1
Fix Version/s: 1.15.2
Mobs, if they have the ability to pick up items, normally only replace armour and swords with other armour or swords of better quality. However, it seems there is a bug in this rule that makes them pick up items whose damage state is more damaged than what they already have, rather than less damaged.
- Summon a mob which can pick up items
- Set the mobGriefing gamerule to true if it is not already
- Throw a slightly damaged chestplate at the mob
- Throw a nearly broken chestplate of the same material at the mob
→ You will notice that the mob picked up the nearly broken chestplate and dropped the slightly damaged one
2014-01-07_21.14.39.png - zombie with enchanted helmet and chestplate.
2014-01-07_21.14.47.png - zombie after replacing its armour with the inferior unenchanted versions seen held by the player in the first screenshot.
2014-01-07_21.15.28.png - The armour drops released by the zombie when it took that armour.
2014-01-07_21.15.50.png - The damaged armour, neatly returned when the mob is killed (making it infinitely reusable for the same trick).
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLiving.updateEquipmentIfNeeded(EntityItem) checks for swords and armor if the damage of the item to pick up is higher than the one it is already wearing.
Note: If the MCP names are correct (which seems to be the case) the method should probably call the method getItemDamage() instead of getMetadata() in case the latter one gets changed to not return the damage.