Fast exit when no chunk should be unloaded

This commit is contained in:
TheMode 2021-05-07 20:29:37 +02:00
parent 52732ed4cd
commit a33234d886

View File

@ -793,6 +793,10 @@ public class InstanceContainer extends Instance {
* Unsafe because it has to be done on the same thread as the instance/chunks tick update.
*/
protected void UNSAFE_unloadChunks() {
if (scheduledChunksToRemove.isEmpty()) {
// Fast exit
return;
}
synchronized (scheduledChunksToRemove) {
for (Chunk chunk : scheduledChunksToRemove) {
final int chunkX = chunk.getChunkX();