mojira.dev
MC-56653

Zombified Piglins drop XP and rare drops if killed by anything while in angered state

The bug

If a piglin is in a hostile state due to another piglin being attacked by the player or any other mob, it will drop XP and rare drops upon death by any source (including mob damage, suffocation and /kill).

To reproduce

  1. Construct some iron golems. Spawn multiple zombified piglins. Wait for the golems to kill the piglins. Experience orbs will be dropped, and maybe also rare drops if you're lucky.

  2. Trap a skeleton where he can shoot at you but not escape. Spawn multiple zombified piglins in the line of fire. Experience orbs will be dropped, and maybe also rare drops if you're lucky.

  3. Summon multiple piglins and a single Johnny vindicator. Killing the piglins with /kill @e[type=piglin,distance=..10] or suffocating them before their anger timer runs out (after 20-40 seconds) should cause them to drop XP, despite never having interacted with the player.

Analysis

From a decompilation of 14w21b's class "abd" method bz() (which appears to be the "for each tick" AI handler for zombified piglins), there is code that appears to be checking for whether the piglin is angry and has the UUID of who he's angry at but no actual target, and if so it attempts to find the player corresponding to the UUID. And for some reason it also sets what appears to be the "damaged by player" counter (field "aM"), even if the UUID doesn't actually correspond to a player. And further, it appears to be setting the counter to the wrong value.

It appears that it'll also set the "damaged by player" counter incorrectly when loading the zombified piglin from NBT, although in this case I'd guess it'll probably be setting it to 0 so it shouldn't matter much.


Code analysis by @unknown can be found in this comment.

Linked issues

MC-269058 Zombified piglins drop experience when killed while in angry Resolved MC-68106 Zombie Pigman/Pigmen drop xp and loot as if you attacked them Resolved MC-264094 Zombified Piglins drop XP when killed by Warden Resolved MC-192566 Zombie Piglins killed by named Vindicator (Johnny) drops XP Resolved MC-188492 Zombie Pigmen/Zombified Piglins drop XP and rare drops if killed by anything while in angered state Resolved

Attachments

Comments 99

Note it's not just iron golems. I've personally tested skeletons, and I suspect any mob that you can get to attack the zombie pigmen would work.

confirmed 14w25b and 14w25a

For some reason, it only happens some times with me.

confirmed for 14w28a

89 more comments

revert the fix, the gold farms are a pain to build and you should be able to reap a reward for a few hours of hard work.

also bedrock gold farms use trident killers, maybe implement those before doing this to us.

It’s been 10 years, this was now a mechanic used by player for a decade and it just broke farms. At this point this was now a feature not a bug. Revert this, it makes no sense to have done this so long after. people who did not want the xp make no sense.

Revert the fix, it broke so many farms that take hours to build. After 10 years it already became a feature.

Revert it. There’s no other functionality that creates a fully automatic xp farm than this. This only affects players who spend 10 plus hours building a massive build and it affects them negatively.

It ruined my hardcore mode gold farm and hope to change it back。(1400days)

Anomie X

(Unassigned)

Confirmed

Gameplay

Normal

Mob behaviour

zombified_piglin

Minecraft 14w21a, Minecraft 14w21b, Minecraft 14w25a, Minecraft 14w25b, Minecraft 14w27b, ..., 23w33a, 1.20.4, 24w09a, 1.21, 1.21.4

1.16 Pre-release 1, 25w02a

Retrieved