BB Preload World
Modern versions of Distant Horizons now support chunk loading in multiplayer, so if you're using a recent version, this mod might not be necessary for you.
This modification enables chunk loading for Distant Horizons functionality in both single-player and multiplayer modes.
In multiplayer, Distant Horizons can only cache chunks that the player has already visited. This mod switches the player to spectator mode and moves them around the map so the client can preload these areas.
An additional benefit is that client-side mini-maps will also be loaded during this process.
Usage
The mod must be installed on both client and server.
When playing in single-player mode, it's recommended to disable the "Enable distant generation" option in Distant Horizons settings while running the preloading procedure.
You can also set the "CPU Load" parameter in Distant Horizons settings to one of the higher profiles (remember to set it back afterward!).
To load the surrounding area, players can use the command /bb_preload_world_start
To interrupt the process before it completes automatically, use the command /bb_preload_world_stop
(Running the stop command before the procedure finishes may result in corrupted chunk caches)
With a radius of 30 chunks, the process can take over 30 minutes, and with 60 chunks - several hours.
Settings
Settings are managed through game rules.
/gamerule bb_preload_radius 30 sets the radius (in chunks) that will be loaded around the player.
/gamerule bb_preload_world_start_requires_opp true requires operator privileges to use the /bb_preload_world_start command.
/gamerule bb_preload_world_stop_requires_opp true requires operator privileges to use the /bb_preload_world_stop command.
How It Works
When starting the preloading procedure, the server-side part of the mod tracks which chunk the player has reached.
The client sends packets to the server indicating when chunks have been cached at LOD levels 0-6. Upon receiving such a packet, the server moves the player to the next chunk.
The client also notifies the server if "Queued chunk updates" is too high, or if there are "Update propagator tasks" in the queue or being processed. If any of these situations occur, the procedure pauses to allow chunks to complete processing before continuing.
This is because if the client leaves a chunk that has started processing but hasn't finished, it can leave that chunk's cache in a corrupted state.