Alternative Chunk Ticking Selection #356
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Minecraft 1.8 vanilla, the server selects chunks around the player (limited by the server's view distance) and stores them in a list, then ticks them. After each tick, the list is cleared.
This is a complete performance disaster. To work around this, Spigot implemented an alternative system:
It limits the ticking radius around the player to 7 and caps how many chunks are ticked per tick. Additionally, it randomly selects chunks to tick each tick based on the number of players in them, thus modifying the rate of plant growth. If a chunk is unloaded or queued for unloading, it is removed from the list and skipped.
The Spigot system is efficient, but it presents some compatibility issues with vanilla, since not all surrounding chunks are ticked.
This pull request backports the chunk selection system from Minecraft 1.9 for ticking. How it works:
TODO: