mojira.dev
MC-210607

Using a spawn egg on zombies, zombie villagers, piglins, or zombified piglins in a filled boat causes the baby to suffocate in the ground

For example, if you spawn a baby zombie by using a spawn egg on a zombie in a boat that is filled (i.e. there's another entity in the boat), the baby zombie will go into the ground and suffocate.

Video

[media]

Code analysis

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

Related issues

Attachments

Comments

migrated
[media][media][media]
migrated
[media][media][media]
Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Mask3D_WOLF

It seems to be partially fixed in 21w05a as the villager does not go straight under, but you can see the top of his head for some/all of it.

Avoma

Can confirm in 1.16.5.

Avoma

Can confirm in 21w16a.

Avoma

Can confirm in 1.17.

Avoma

Can confirm in 1.18.1.

Avoma

I can confirm this behavior in 1.18.2 and 1.19 Pre-release 4. It's important to note that this issue can be seen with any ageable mob and isn't just exclusive to villagers. Here's a code analysis regarding this issue.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.19 Pre-release 4 using Mojang mappings.

net.minecraft.world.item.SpawnEggItem.java

public class SpawnEggItem extends Item {
   ...
   public Optional<Mob> spawnOffspringFromSpawnEgg(Player player, Mob mob, EntityType<? extends Mob> entityType, ServerLevel serverLevel, Vec3 vec3, ItemStack itemStack) {
      ...
      Mob mob2 = mob instanceof AgeableMob ? ((AgeableMob)mob).getBreedOffspring(serverLevel, (AgeableMob)mob) : entityType.create(serverLevel);
      ...
      mob2.setBaby(true);
      ...
      mob2.moveTo(vec3.x(), vec3.y(), vec3.z(), 0.0f, 0.0f);
      ...

If we look at the above class, we can see that when a spawn egg is used on an ageable mob, the new baby entity is spawned at the parent's location. This is evident through the following line of code:

mob2.moveTo(vec3.x(), vec3.y(), vec3.z(), 0.0f, 0.0f);

When a given entity is in a boat, its hitbox isn't shortened (MC-80877) and because of this, it penetrates the bottom of the boat. Since an entity's position in the world is determined by the bottom center of its hitbox, this results in the newly summoned baby entity being placed at its parent's position (which is too low down when they're inside boats) resulting in them sinking through and suffocating in the ground when summoned.

Avoma

Can confirm in 1.19.

Avoma

Since the height at which some ageable mobs sit in boats was changed in newer version of the game, this issue is now exclusive to zombies, zombie villagers, piglins, and zombified piglins.

migrated

This issue now very much relates to/is caused by MC-80877.

migrated

This issue now very much relates to/is caused by MC-80877.

Mask3D_WOLF

(Unassigned)

Confirmed

Platform

Low

Mob spawning

spawn-egg, suffocate

20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, ..., 1.20.1, 1.20.4, 23w51b, 1.21.1, 24w38a

Retrieved