PaperMC/patches/server/0764-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch

39 lines
1.8 KiB
Diff
Raw Normal View History

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
2023-12-06 17:00:26 +01:00
index bc181f3f59eef3f2f3645e3facb37d5e4a605d34..3b6b421c0749d676fe48a49a569f5a6013576730 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2023-12-06 17:00:26 +01:00
@@ -1422,19 +1422,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
2023-09-23 00:33:14 +02:00
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
2023-12-06 17:00:26 +01:00
if (this.tickRateManager.isSprinting() || this.haveTime()) {
Iterator iterator = this.getAllLevels().iterator();
2023-12-06 17:00:26 +01:00
while (iterator.hasNext()) {
- ServerLevel worldserver = (ServerLevel) iterator.next();
+ WorldServer worldserver = (WorldServer) 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
}
}