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-274506 Villagers spawn stuck in walls 村民生成时卡在墙里 Resolved MC-277769 Villagers can sometimes spawn in blocks Resolved MC-181684 Villagers can spawn in desert villages roofing Resolved MC-260802 When desert village is spawned, 1 of 2 sheep are instantly killed in Shepherd's House 1 Resolved MC-239239 Repeated 'Villager suffocated in a wall' output messages directly from snow huts Resolved

Attachments

Comments 18

1.14
1.14.1
1.14.2
1.14.3
1.14.4 Confirmed

Affects even their animals

confirmed for 1.15.2

Can confirm in 1.17.1 Release Candidate 2.

8 more comments

Can confirm in 23w03a

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

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.)

Player

(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, 24w34a, 1.21.4, 25w02a, 25w35a

Retrieved