Fix ticking distances (mob spawn range, entity, chunk and block ticking distances)#7053
Fix ticking distances (mob spawn range, entity, chunk and block ticking distances)#7053rafaelsms wants to merge 4 commits into
Conversation
rafaelsms
commented
Dec 6, 2021
- Mob spawn range: trackers have been updated to use Spigot's mob spawn range instead of MOB_SPAWN_RANGE (static value of 8)
- Mob spawn range is still limited to 8 chunks max, but now we either limit it by the view distance or the simulation distance, the greatest of both
- Trackers that used view distance have been replaced with simulation distance (such as ticking blocks and entities) as we would only iterate through more chunks without any benefit
- Chunk ticking now uses the maximum range between mob spawn and chunk ticking (which uses simulation distance), it'll check only one condition and assume the other one
- for example, if mob spawn > simulation distance, we will iterate every chunk in mob spawn range, but we will only check if we should tick on those chunks
- if mob spawn < simulation distance, we will iterate every chunk in simulation distance, but we will only check if we should spawn mobs on those chunks
- Entity activation is already updated by Spigot's ActivationRange, which is limited by simulation distance
- Entity ticking already checks chunk's ticking tracker
| } | ||
| } else { | ||
| - final double range = (DistanceManager.MOB_SPAWN_RANGE * 16) * (DistanceManager.MOB_SPAWN_RANGE * 16); | ||
| + final double range = (level.spigotConfig.simulationDistance * 16.0) * (level.spigotConfig.simulationDistance * 16.0); |
There was a problem hiding this comment.
this is executed when reducedRange = false, which is removed from the code now (after this patch, reducedRange = true always)
|
#7054 will be fixed by this PR (edit: I don't know how to link issues) |
|
modifications to existing patches should be made in those patches rather than creating an additional one |
Ok! I'll try to do it later. The last time I tried, I couldn't get it to rebuild patches correctly from the commits and some changes were left out in some patches. I'll try to do it again more cleanly this time. Any tip would be appreciated. |
|
Well, the block ticking issue was fixed by Spottedleaf (758e2a7), so I will close this as my changes are a little bit hash on vanilla working. |