mojira.dev
MC-2025

Mobs going out of fenced areas/suffocate in blocks when loading chunks

The bug

Mobs can intersect with blocks, which are right next to the mobs, when the chunk they are in was previously saved and is now loaded. This can cause the mobs to suffocate and die or to escape enclosed areas.

Reasons

This is a list of all (possibly) reasons which can cause this bug. These reasons do not exclude each other.

Bounding box precision loss

Caused by floating point inaccuracies, first described in this comment.

Explanation of bug and fix (Worth reading!)

Mobs moving in unloaded chunks

See @unknown's comment but might not happen, see this comment.

Baby mobs growing up

This is definitely one reason, see this comment and MC-103313.

Linked issues

MC-2037 Black Sheep glitching through walls Resolved MC-3753 Mobs can get out of a fence Resolved MC-4707 Mobs glitch through floor/walls on chunk loading Resolved MC-5187 Cows have an odd tendency to glitch through cobblestone walls. World originally made in 1.3.2. Resolved MC-5230 Cows walking through fences. Resolved

Attachments

Comments 599

Seconding this. Quit the world with 13 cows and MANY chickens in pens; come back to 8 cows and 5 chickens in pens. The cows were dispersed around the place, I herded 3 back in... but I don't know what happened to the chickens. In 1.4.2 on a server where their pens bordered on walls I'd sometimes see the animals' drops (and one or more animals missing) when their chunk re-entered memory, and playing 1.4.4 it looks like the issue still isn't solved.

Nicholas Williams

I can confirm that this happens though only with pigs and chickens in my case. It seems to occur whenever the chunks are loaded because a similar phenomenon occurs when traveling around and coming back. Also, looking at the reports that this "duplicates", I have to say that this appears to be a similar problem.

As for the cause, I think it is due to animals butting up against cobblestone walls and wooden fences. When they're reloaded either at the start of the game session or being back in the area, the animals appear on the other side of the fence since animals right against fences appear to be inside them. The game mistakes the animals for being outside when they were inside.

Voted. This is a very annoying bug and it affects a lot of things (all walking mobs for sure). For example an iron golem farm. Iron golems or villagers can be found out of enclosed areas. When all villagers escape, the iron golem farm will be ruined. So you always have to use workarounds.

Voted, I also realized that I can kill chicken that appear to be outside the fence when they are actually inside. The drop appears at the correct location (inside). I also find eggs outside of the fence.

Martijn Jongkind

Breeding systems with minecarts also don't work because the animals are not. Cows are near the cart but not in the cart, they will also 'teleport' vertically if the cart was on a second floor of a barn e.g.

589 more comments

Still in 1.20.1, keeps ruining my villager hall...

Affects 1.21

Minecraft386882

Can confirm for 1.21.3

Minecraft386882

Confirmed in 1.21.4

TLDR:
Various bugs causing MC-2025 have been fixed over the years. The remaining ones listed here are no longer reproducible.
If you are still encountering issues please follow the steps to create a new report for them.
 
Happy 2025!

 

The long version:

Hello everyone!
 
MC-2025 is the most up-voted bug report on the bug tracker. It has been open for over 12 ⚠️ years with so many contributions and reproductions from so many people.
That the issue is still open after 12 years is not down to a lack of trying to fix it. But the reality is, that there have been a lot of different contributing factors in the code, resulting in many different issues manifesting in a similar way.
As specific causes got fixed, the details on this report have been updated to match the remaining ones.
At this point a lot of them - in fact all that we are aware of - have been fixed!
 
It's not easy to get a full list of the underlying problems that caused MC-2025 and related issues, since many of them were never separately tracked as an own bug report.
 
But here is a list of a couple we were able to find:

  • Collision boxes having floating point rounding issues at high coordinates
    Fixed in 1.5

  • Collision boxes being globally changed from several threads
    Fixed in 15w38a (1.9)

  • Collions issues on chunk loading
    Fixed in 17w47a (1.13)

  • Baby mobs growing up next to blocks (MC-9568)
    Fixed in 21w05a (1.17)

  • Chickens spawned from eggs being in blocks
    Fixed in 21w05a (1.17)

  • Frogs growing up next to blocks (MC-253791)
    Fixed in 24w19a (1.21)

  • Baby mobs growing up next to blocks below blocks (MC-252846)
    Fixed in 24w19a (1.21)

But there is no doubt there was more!
 
 
So, what about the possible reasons that are still listed in the description of this report?

  • Floating point inaccuracies
    We got no working reproduction steps and nothing that would suggest this is still an issue.

  • Mobs moving in unloaded chunks
    It's questionable this ever was an actual issue. If it was, it has been fixed long ago.

  • Baby mobs growing up
    Fixed as per MC-9568, MC-253791 and MC-252846

With all this said, at this point we see no value keeping MC-2025 open.
It looks like the issue described by the title "when loading chunks" has been fixed by larger collision refactors in 17w47a (1.13), so we will be setting this as the fixed version.
The issues of mobs growing up next to blocks getting out was likely the reason MC-2025 got reopened the last time it did, but this has been fixed since.
 
If you are still encountering issues of this kind, please don't ask for this report to be reopened, but instead follow the steps to create a new report.
 
Thank you for all the contribution on this and other issues over the years!
 
Happy 2025 and hpp new er!

Kevin Delcourt

(Unassigned)

Confirmed

Platform

Normal

Entities, Hitboxes

animal, area, chunk, cobblestone_wall, fence, mob, outside

Minecraft 1.4.2, Minecraft 1.4.4, Minecraft 1.4.5, Snapshot 12w50b, Minecraft 1.4.6, ..., 23w04a, 1.20.1, 1.21, 1.21.3, 1.21.4

Minecraft 15w45a, Minecraft 17w47a

Retrieved