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

Zombie villager converted from villager gets PersistenceRequired depending on whether attacking zombie had it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 20w20a
    • Fix Version/s: 20w22a
    • Labels:
      None
    • Confirmation Status:
      Plausible
    • Category:
      Mob behaviour, Mob spawning
    • Mojang Priority:
      Normal

      Description

      The bug

      When a villager is killed by a zombie and converts to a zombie villager, the zombie villager will have PersistenceRequired set depending on whether the attacking zombie had it.
      This is incorrect, it should be set depending on whether the villager which was killed had it set.

      Reproduction steps

      1. Summon a villager with PersistenceRequired:0b (encase it, to make the next steps easier)
        /summon villager ~ ~ ~ {PersistenceRequired:0b,Health:1f}
        
      2. Set the difficult to Normal or Hard
      3. Summon a zombie or subtype which has PersistenceRequired:1b
        /summon husk ~ ~ ~ {PersistenceRequired:1b}
        
      4. Wait until the villager was killed
      5. Inspect the NBT data of the new zombie villager
        /data get entity @e[type=zombie_villager,limit=1,sort=nearest] PersistenceRequired
        

        It has PersistenceRequired:1b

      Code analysis

      20w19a, Mojang names

      The check in Zombie.killed(LivingEntity) is incorrect:

      if (this.isPersistenceRequired()) {
          zombieVillager.setPersistenceRequired();
      }
      

      This should be if (villager.isPersistenceRequired()) instead.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cojomax99 [Mojang] Cory Scheviak
              Reporter:
              marcono1234 [Mod] Marcono1234
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                CHK: