aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0854-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch
blob: acba477db3a1c5514e9decba7bbb671723e6c6e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 28 Dec 2021 07:19:01 -0800
Subject: [PATCH] Execute chunk tasks fairly for worlds while waiting for next
 tick

Currently, only the first world would have had tasks executed.
This might result in chunks loading far slower in the nether,
for example.

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 01aefce226ae82d707b38b0d56d2580d411a3c9a..c2c1242bcf26c73b3520c797e77c3c2d430dfac7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1354,6 +1354,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
             this.executeMidTickTasks(); // Paper - execute chunk tasks mid tick
             return true;
         } else {
+            boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
             if (this.haveTime()) {
                 Iterator iterator = this.getAllLevels().iterator();
 
@@ -1361,12 +1362,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
                     ServerLevel worldserver = (ServerLevel) iterator.next();
 
                     if (worldserver.getChunkSource().pollTask()) {
-                        return true;
+                        ret = true; // Paper - force execution of all worlds, do not just bias the first
                     }
                 }
             }
 
-            return false;
+            return ret; // Paper - force execution of all worlds, do not just bias the first
         }
     }