Skip to content

Conversation

@uRyanxD
Copy link
Collaborator

@uRyanxD uRyanxD commented Sep 23, 2025

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:

  • Retrieve all active PlayerChunks.
  • If the chunk is null, skip to the next one.
  • If the chunk needs ticking due to world generation or internal chunk systems, tick it.
  • If the chunk has no players, or only spectators, and is 8 chunks away from any player (i.e., will be unloaded soon), it is skipped.

TODO:

  • Leave the system configurable? Since this system probably needs to use a little more memory
  • Add comments and cleanup
  • More tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant