The bug
The mob spawning algorithm is slow and impacts the game's TPS. This is mostly noticeably in a flat world with the gamerule doMobSpawning enabled; the tps heavily decreases. When checking the source with /debug
, it showed mobSpawner
as source:
[00] levels - 99.62%/99.62%
[01] | New World - 99.82%/99.45%
[02] | | tick - 98.85%/98.30%
[03] | | | mobSpawner - 91.42%/89.87%
[03] | | | entities - 6.79%/6.67%
The lag impacts all worlds, but the amount of impact depends on how many mobs are able to spawn. (normal world with high render distance will lag more than a normal world with low render distance, for example)
How to reproduce (using a flat world, since it's most noticeably there)
Create a flat world (default settings)
Observe that everything is really slow (slimes, animals, sun)
Disable doMobSpawning:
/gamerule doMobSpawning false
Now the tps is back to normal
Linked issues
is duplicated by 1
Comments 13
I think has something to do with the mob spawning code, it even happens in default worlds sometimes. It never lagged this much in 1.12
I can confirm this. This bug exists since version 18w19a.
In a flat world with 0, 1 or 2 layers the game lags greatly, if you create a flat world with let's say 10 stone layers, the lag is reduced because the spawn attempts can not start there. When MobSpawning is turned off no lag is noticeable.
So the spawn code is somehow broken.
They really need to fix this because it makes the game unplayable because of all the lag, I try and fight mobs at night and they all lag and I can't kill them and then they speed up to me and kill me.
Biome Happens?
0 / minecraft:ocean YES
1 / minecraft:plains YES
2 / minecraft:desert YES
8 / minecraft:hell NO
14 / minecraft:mushroom_island YES
40 / minecraft:sky_island_low NO
The slow down also depends on the render distance
Oh, interesting. I actually experienced a MAJOR tps drop (~1 tick per second) a few weeks ago that persisted for a while. It turned out that's because I set my render distance to 32, and while I was getting a decent FPS, it broke the TPS. Reducing it down to 10 or so solved that. The important thing, though, is that that wasn't in a superflat world, but a normal world; perhaps this isn't exclusive to superflat?
Yeah the summary isn’t correct. It’s not just about flatworlds, it’a about the mob spawning algorythm being really slow. This explains why it’s present in non-superflat worlds with high render distance (more chunks to spawn mobs) and why it doesn’t happen in all biomed (nether/end spawning algorythm might be different). I’ll try to update the summary (and description) tomorrow
It's because hundreds of slimes are spawning in less than one minute
in a flat world
(Slimes are spawning at a height between 1-40)