mojira.dev
MC-312186

Mobs drop the weapon they replace with full durability instead of random durability

When a mob picks up a weapon it considers better, it has about a chance to drop the weapon it was holding. That drop skips the random durability damage that equipment gets when a mob drops it on death, so equipment the mob spawned with comes out at full durability and keeps any enchantments

Steps to reproduce:

Set Difficulty to Hard

Summon a horde of zombified piglins

Throw weapons with higher rating than gold swords next to them

Some of the zombified piglins that pick up the better equipment also drop their weapons

The dropped weapons have full durability

Expected result:
The replaced weapon gets the same random durability damage as a death drop

Actual result:
The replaced weapon drops with full durability

Code analysis (26.2, official names):

Mob.equipItemIfPossible drops the replaced item with spawnAtLocation and no durability change:
https://mcsrc.dev/2/26.2/net/minecraft/world/entity/Mob#L553-561

Mob.dropCustomDeathLoot applies random damage to equipment that isn't a guaranteed drop (drop chance above 1.0):
https://mcsrc.dev/2/26.2/net/minecraft/world/entity/Mob#L907-915

Possible fix: apply the same damage in equipItemIfPossible when !this.dropChances.isPreserved(slot)

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media]

CyndaFr

(Unassigned)

Unconfirmed

26.3

Retrieved