mojira.dev
MC-146770

Villagers and mobs are spawned in floating and offset in villages upon world generation, occasionally getting stuck and suffocating

The bug

Villagers, zombie villagers and passive mobs inside villages are spawned into the world one block too high. This causes them to occasionally get stuck, especially since they also are shifted into the wall occasionally.

All types of villagers are affected (unemployed, nitwits, babies, and zombie villagers). Also, all biome variants of villagers are affected.

How to reproduce

  1. Create a world with the seed 5322602735514886292

  2. Run

    /setblock ~ ~ ~ minecraft:repeating_command_block{auto:1b,Command:"execute as @e[type=villager,nbt=!{NoAI:1b}] run data merge entity @s {NoAI:1b}"}
  3. Run

    /tp @s -5967 68 2598
  4. Look around
    → ❌ You will notice that all villagers are floating inside of the air, and the villager near /tp -5986 68 2555 even is stuck inside of the wall of its house

If you reproduce this without the command block, most villagers will be able to roam around freely, but some still are stuck in walls.

[media]

[media]

See another example in this comment.

The cause

All villagers in the villager structure files are spawned on top of the jigsaw block instead of inside of it. Also, some villagers (especially baby villagers) spawn with their hitbox partially outside of the block they're standing in.

[media]

[media]

[media]

Linked issues

MC-142397 Floating Villagers MC-148303 Desert villagers spawning mid-air, stuck with their heads inside of the roof block MC-148549 The villagers who get up from the bed of some houses in the desert village get their heads in the ceiling MC-150060 Villagers in Desert villages get stuck in shorter houses MC-152920 Vilagers spawn ontop of blocks with head inside block. MC-155018 Villagers spawn stuck in the slab roofs sometimes MC-165626 Villagers and animals sometimes in villages spawn at wrong location MC-166612 Villager Spawns on Bed and Suffocates MC-168841 villagers spawn in walls MC-178760 Desert villager glitch MC-181684 Villagers can spawn in desert villages roofing MC-189468 A snow village structure spawns with a villager drowning MC-200517 Villagers get stuck in blocks MC-201563 villagers in snowy tundra MC-202812 Some villagers in desert are standing inside the wall MC-217483 Disturbing villager spawnpoint MC-234108 Villages Homes in snow biomes kill Inhabitants MC-239239 Repeated 'Villager suffocated in a wall' output messages directly from snow huts MC-260802 When desert village is spawned, 1 of 2 sheep are instantly killed in Shepherd's House 1 MC-274506 Villagers spawn stuck in walls 村民生成时卡在墙里 MC-277769 Villagers can sometimes spawn in blocks MC-297629 Villagers taking themselves out by standing on bed in snow village.

Attachments

Comments

migrated

1.14
1.14.1
1.14.2
1.14.3
1.14.4 Confirmed

migrated

Affects even their animals

Justerfrog

confirmed for 1.15.2

migrated

Seeing this in 20w18a.

Avoma

Can confirm in 1.17.1 Release Candidate 2.

ampolive

Can confirm in 21w40a.

bdm68

Confirmed in 21w43a. I reproduced this by generating a large area of terrain using a redstone mechanism. Occasionally the log gets messages about villagers suffocating and includes coordinates. The coordinates turned out to be villager houses.

ampolive

This also affects zombie villages. Can confirm in 21w44a.

ampolive

Can confirm in 1.18 Pre-release 1.

ampolive

Can confirm in 1.18 Pre-release 4.

Moesh

I have confirmed this and have a solid repro case. I think it is OK to just keep adding the affected versions instead of leaving comments.

3984153921072542614

/execute in minecraft:overworld run tp @s 2778.34 74.16 12476.52 289.83 27.30

ampolive

This issue isn't exclusive to villagers, I just witnessed two cows spawn floating on generation and one of them got stuck in a wall and died.

pulpetti

In 1.19 Pre-2.

Brain81505

Can confirm in 23w03a

migrated

i confirm in 23w04a. the seed is -8347609665039207485, and the location is /execute in minecraft:overworld run tp @s -3647.30 65.00 6011.57 685.17 79.95

Geoffreylikespie

With the new /tick command's functionality, I think this bug could finally be fixed relatively easily. I believe the issues at the source of this problem are that previously, having mobs with AI inside jigsaw blocks wouldn't have been possible, and the mobs would have needed to be contained by barrier blocks while their structures are being saved. This would have allowed some mobs to move towards the edge of their 1x2x1 barrier enclosure, which causes slight overlap between their hitboxes and the adjacent blocks.

Now, however, someone can run /tick freeze and then recreate these jigsaws pieces containing entities. You can summon mobs with AI sitting at the same height as the jigsaw block, since they won't be forced out while ticks are frozen. Likewise, mobs can't move to the edge of their barrier enclosures while ticks are frozen (barriers wouldn't even be needed), thus preventing any overlap with adjacent blocks. If entities are summoned at the bottom of the jigsaw block and at the block's horizontal center, and then those jigsaw pieces are saved to replace the old ones, this should fix both villagers getting stuck in the ceiling and villagers getting stuck in walls. I believe this would also fix issues with village-generated zombie villagers, pigs, cows, and sheep. It might not fix issues with any village-generated iron golems, horses, or camels, as those entities all have hitboxes that pass the bounds of a 1x2x1 volume.

I have tested a tiny bit in creative: structure blocks can still be saved and loaded while ticks are frozen, and after unfreezing ticks these mobs loaded from structure blocks have AI and act normally. (I have not confirmed that my proposed fix would actually fix the issue, but if I should do that I can try.)

COMETC2021A1

In 1.20.5

Minecraft386882

Confirmed in 1.21.4 

migrated

(Unassigned)

Confirmed

Gameplay

Normal

Structures, Village system, World generation

mob, spawning, stuck, villager

Minecraft 19w12b, Minecraft 1.14, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 2, 1.14.4, ..., 1.21, 1.21.1, 24w34a, 1.21.4, 25w02a

Retrieved