Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-56653

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



    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 14w21a, Minecraft 14w21b, Minecraft 14w25a, Minecraft 14w25b, Minecraft 14w27b, Minecraft 14w28a, Minecraft 14w29b, Minecraft 14w32a, Minecraft 14w32b, Minecraft 14w32c, Minecraft 14w32d, Minecraft 14w34b, Minecraft 1.8-pre1, Minecraft 1.8-pre2, Minecraft 1.8-pre3, Minecraft 1.8, Minecraft 1.8.1-pre2, Minecraft 1.8.1, Minecraft 1.8.2-pre1, Minecraft 1.8.2-pre2, Minecraft 1.8.2-pre3, Minecraft 1.8.2-pre4, Minecraft 1.8.2-pre5, Minecraft 1.8.2-pre6, Minecraft 1.8.2-pre7, Minecraft 1.8.2, Minecraft 1.8.3, Minecraft 1.8.4, Minecraft 15w32b, Minecraft 15w44b, Minecraft 15w45a, Minecraft 15w47a, Minecraft 15w49a, Minecraft 15w49b, Minecraft 15w50a, Minecraft 15w51b, Minecraft 16w02a, Minecraft 16w03a, Minecraft 16w04a, Minecraft 16w05a, Minecraft 16w05b, Minecraft 1.9 Pre-Release 1, Minecraft 1.9 Pre-Release 2, Minecraft 1.9 Pre-Release 3, Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 16w14a, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 1.10.2, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12.2, Minecraft 18w16a, Minecraft 1.13-pre7, Minecraft 1.13-pre10, Minecraft 1.13, Minecraft 18w31a, Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2-pre1, Minecraft 1.13.2, Minecraft 19w04b, Minecraft 1.14 Pre-Release 5, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, 1.14.4, 1.15.2, 20w09a, 20w13b, 20w16a, 20w21a, 20w22a, 1.16 Pre-release 3, 1.16.1
    • Fix Version/s: 1.16 Pre-release 1
    • Labels:
    • Confirmation Status:
    • Category:
      Mob behaviour
    • Mojang Priority:


      The bug

      If a pigman is in a hostile state due to another pigman 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

      • Construct some iron golems. Spawn multiple zombie pigmen. Wait for the golems to kill the pigmen. Experience orbs will be dropped, and maybe also rare drops if you're lucky.
      • Trap a skeleton where he can shoot at you but not escape. Spawn multiple zombie pigmen in the line of fire. Experience orbs will be dropped, and maybe also rare drops if you're lucky.
      • Summon multiple pigman and a single Johnny vindicator. Killing the pigmen with kill @e[type=zombie_pigman,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.


      From a decompilation of 14w21b's class "abd" method bz() (which appears to be the "for each tick" AI handler for zombie pigmen), there is code that appears to be checking for whether the pigman 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 zombie pigman 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 [Mod] Marcono1234 can be found in this comment.


          Issue Links



              Unassigned Unassigned
              anomie x Anomie X
              41 Vote for this issue
              42 Start watching this issue