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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • 1.16 Pre-release 1
    • 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, 1.16.2, 1.16.4 Pre-release 2, 1.16.4, 20w49a, 20w51a, 21w05b, 1.17 Release Candidate 1, 1.17 Release Candidate 2, 1.17, 1.17.1 Pre-release 3, 1.17.1, 1.18 Pre-release 1, 1.19 Pre-release 5, 1.19, 1.19.2, 1.19.3, 23w03a, 1.20.1, 23w33a, 1.20.4, 24w09a
    • Confirmed
    • Mob behaviour
    • Normal
    • Gameplay

      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 marcono1234 can be found in this comment.

            Unassigned Unassigned
            anomie x Anomie X
            Votes:
            57 Vote for this issue
            Watchers:
            46 Start watching this issue

              Created:
              Updated:
              CHK: