Villagers stop working and sleeping in worlds a few years old
Based on this report and duplicate report MCPE-86843, villagers display the following problems when a world's Time exceeds 2^31, or 89,478 game-days. This would be equivalent to just under 3.5 real-world years of runtime if players never slept in-game; 1.75 years of runtime if they slept every night. Some 1-player sleep systems may cause this issue to occur sooner than it would otherwise.
- Will not sleep
- Will not wake up naturally (they can be woken by the player, but will try to sleep again)
- Will not refresh trades
- May not spawn iron golems
Original summary
Integer Overrun Error causes villagers not to restock.
When the Time goes over 2147471640 (approximate, probably 2,147,483,648=2^31), it becomes negative.
Once the time is negative, advancing days is applied inconsistently to other times and timers. In particular, villagers do not restock. Villagers would still not restock after breaking and re-placing their workstations, which is what led me to discover this bug.
This can be fixed by setting the time to 0 if it is negative.
This occurred on a realm, so I reproduced it using command blocks for this bug report.
2020-08-29, 06:28 AM
2022-01-21, 05:27 AM
2021-11-30, 05:45 PM
18
5
424456