Mojira Archive
MC-129620

Mob spawning algorithm is super slow

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)

  1. Create a flat world (default settings)
  2. Observe that everything is really slow (slimes, animals, sun)
  3. Disable doMobSpawning:
    /gamerule doMobSpawning false
  1. Now the tps is back to normal

Fixed

Alex³

Rikard Herlitz

2018-05-15, 06:36 PM

2018-06-15, 11:32 AM

2018-06-15, 11:32 AM

18

10

Community Consensus

Minecraft 18w20a - Minecraft 1.13-pre1Minecraft 18w20a, Minecraft 18w20b, Minecraft 18w20c, Minecraft 18w21a, Minecraft 18w21b, Minecraft 18w22a, Minecraft 18w22b, Minecraft 18w22c, Minecraft 1.13-pre1

Minecraft 1.13-pre2