Add more to the save fixes
- Set forceTicks to true, so that player packets are always processed so that the main process queue can be drained
This commit is contained in:
parent
196271de4e
commit
1e12cf8db6
|
@ -8,9 +8,11 @@ Subject: [PATCH] Fix save problems on shutdown
|
|||
while waiting for the chunk system to empty, as there's simply
|
||||
too much trash that could prevent them from executing during
|
||||
the chunk source tick (i.e "time left in tick" logic).
|
||||
- Set forceTicks to true, so that player packets are always
|
||||
processed so that the main process queue can be drained
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 17e87875a95495940899b862eabf98b3d6a365da..e25c9a9ccab67a018c2e58e13b24089bc2ce538f 100644
|
||||
index 17e87875a95495940899b862eabf98b3d6a365da..39b7c78b032ed6fc29ac765020d5a38858bf2a3a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -998,6 +998,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -27,7 +29,7 @@ index 17e87875a95495940899b862eabf98b3d6a365da..e25c9a9ccab67a018c2e58e13b24089b
|
|||
while (this.levels.values().stream().anyMatch((worldserver1) -> {
|
||||
return worldserver1.getChunkSource().chunkMap.hasWork();
|
||||
})) {
|
||||
@@ -1010,9 +1017,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1010,9 +1017,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.getChunkSource().tick(() -> {
|
||||
return true;
|
||||
}, false);
|
||||
|
@ -35,10 +37,23 @@ index 17e87875a95495940899b862eabf98b3d6a365da..e25c9a9ccab67a018c2e58e13b24089b
|
|||
}
|
||||
|
||||
- this.waitUntilNextTick();
|
||||
+ this.forceTicks = true; // Paper
|
||||
+ while (this.pollTask()); // Paper - drain tasks
|
||||
}
|
||||
|
||||
this.saveAllChunks(false, true, false);
|
||||
@@ -1308,6 +1317,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
+ // Paper start
|
||||
+ if (this.forceTicks) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
// CraftBukkit start
|
||||
if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
|
||||
return this.forceTicks || this.runningTask() || Util.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index b5b56d4549e97abbbe9e91d881b9bca8428f1eec..dce7452d58d6081f1a83baddafb1596ebd423d21 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
|
|
Loading…
Reference in New Issue