The old region scheduler had a few problems:
1. Inability to process intermediate tasks (chunk/packets) leading
to higher than Paper/Vanilla latencies for task processing
2. Thread swapping: scheduled tasks had no thread preference, which
lead to them swapping threads which may not be cache efficient
The new scheduler solves both of these issues. The new scheduler
can process intermediate tasks, and combined with the new packet
scheduler this allows packets to be processed at low latency
provided that the scheduler threads are idle or waiting.
The new scheduler will only move a scheduled tick/task to another
scheduling thread provided that its scheduled start is missed by
a specified time (for now, 2ms). This should ensure that thread
swapping only occurs to meet scheduling deadlines.
We need to verify that the methods are only being invoked
on the global region.
Additionally, do not use CraftWorld#getChunk for retrieving
the Chunk object as it would trip a thread check. Rather,
we construct the CraftChunk manually as it is simply
a world+coordinates wrapper. The call never needed to block
until the chunk was loaded either.
Note that this requires the caller to be on a ticking region
or the global region, otherwise it will throw
UnsupportedOperationException.
Now the function returns the TPS for the current region.