mojira.dev
MC-200418

Cured baby zombie villagers stay as jockey variant

The bug

Currently, curing a baby zombie villager jockey does not cause it to dismount, creating a villager chicken jockey. The villager can also grow up, and it functions exactly as a normal villager, however, it does not dismount the chicken. This is likely caused by the fix of MC-163767.

How to reproduce

  1. Find a baby zombie villager jockey, or spawn one in via commands:

    /summon chicken ~ ~ ~ {Passengers:[{id:zombie_villager,IsBaby:1,ConversionTime:10}]}
  2. Cure the baby zombie villager as you would a normal zombie villager

  3. Wait until it is cured

  4. Observe the fact the villager is still riding the chicken

Code analysis

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

Linked issues

Attachments

Comments 20

Mateus Pereira Milbradt

Isn't this intentional?

Mateus Pereira Milbradt

Can you change "4. Observe the fact the zombie villager is still riding the chicken" to "4. Observe the fact the villager is still riding the chicken"?

Yes, sorry, poor wording

And I don't believe this is intentional behavior, since I don't think there is any practicality of a villager riding a chicken. I also haven't seen any mention of this as a feature in any patch notes.

If this doesn't happen naturally (bc the zombie has to be cured by a player), I don't see the problem on keeping this bug. Seems fun XD

10 more comments

Not necessarily. There could be a check to see which mob the baby zombie villager is riding and dismount it only if it is a chicken.

Can confirm in 21w41a. The expected result is that baby zombie villagers should dismount chickens when cured.

Confirmed with 1.18.1 and 22w06a

@Trevor Collins
What's your grounds for saying so?

I can also confirm this in both 1.18.1 and 22w06a. Here's a code analysis of this issue.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.

net.minecraft.world.entity.monster.ZombieVillager.java

public class ZombieVillager extends Zombie implements VillagerDataHolder {
   ...
   private void finishConversion(ServerLevel serverLevel) {
      Villager villager = this.convertTo(EntityType.VILLAGER, false);

      for(EquipmentSlot equipmentslot : EquipmentSlot.values()) {
         ItemStack itemstack = this.getItemBySlot(equipmentslot);
         if (!itemstack.isEmpty()) {
            if (EnchantmentHelper.hasBindingCurse(itemstack)) {
               villager.getSlot(equipmentslot.getIndex() + 300).set(itemstack);
            } else {
               double d0 = (double)this.getEquipmentDropChance(equipmentslot);
               if (d0 > 1.0D) {
                  this.spawnAtLocation(itemstack);
               }
            }
         }
      }

      villager.setVillagerData(this.getVillagerData());
      if (this.gossips != null) {
         villager.setGossips(this.gossips);
      }

      if (this.tradeOffers != null) {
         villager.setOffers(new MerchantOffers(this.tradeOffers));
      }

      villager.setVillagerXp(this.villagerXp);
      villager.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(villager.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData)null, (CompoundTag)null);
      villager.refreshBrain(serverLevel);
      if (this.conversionStarter != null) {
         Player player = serverLevel.getPlayerByUUID(this.conversionStarter);
         if (player instanceof ServerPlayer) {
            CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer)player, this, villager);
            serverLevel.onReputationEvent(ReputationEventType.ZOMBIE_VILLAGER_CURED, player, villager);
         }
      }

      villager.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0));
      if (!this.isSilent()) {
         serverLevel.levelEvent((Player)null, 1027, this.blockPosition(), 0);
      }
   }

If we look at the above class, we can see that the finishConversion() method, (the method that's responsible for finishing the process of a zombie villager converting into a villager), never checks to see whether or not the villager is a passenger, and if so, should be dismounted upon conversion. Because of this, when a baby zombie villager is cured and converted whilst riding a chicken, it will not stop riding its vehicle, therefore resulting in this problem occurring.

Can confirm in 1.19.

Works as intended as per MC-276342

Sl1mJ1m

(Unassigned)

Confirmed

Mob behaviour

1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, ..., 1.19.4, 23w14a, 1.20.1, 1.20.4, 24w14a

Retrieved