From bb43f75ee6bba71dabcb3eea1fdafaad4a5a6529 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 28 Feb 2022 21:11:35 -0700 Subject: [PATCH] fix issue resulting from kenny's apatch addiction --- .../server/Fix-Chunk-Post-Processing-deadlock-risk.patch | 8 ++++---- .../server/Fix-chunks-refusing-to-unload-at-low-TPS.patch | 8 ++++---- patches/server/Replace-player-chunk-loader-system.patch | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patches/server/Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/Fix-Chunk-Post-Processing-deadlock-risk.patch index 3c67c95f26..f885c3434d 100644 --- a/patches/server/Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -37,14 +37,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - }); + return (LevelChunk) list.get(list.size() / 2); }); }, (runnable) -> { - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); + this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. - }); - return completablefuture1; - } + }).thenApplyAsync((either) -> { + return either.ifLeft((chunk) -> { + chunk.postProcessGeneration(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/patches/server/Fix-chunks-refusing-to-unload-at-low-TPS.patch b/patches/server/Fix-chunks-refusing-to-unload-at-low-TPS.patch index 0267709f98..7a2e85f2a8 100644 --- a/patches/server/Fix-chunks-refusing-to-unload-at-low-TPS.patch +++ b/patches/server/Fix-chunks-refusing-to-unload-at-low-TPS.patch @@ -14,13 +14,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.playerLoadedChunk(entityplayer, mutableobject, chunk); - }); + + return chunk; }); - }, (runnable) -> { -- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. +- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); - }); + }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading - return completablefuture1; } + public int getTickingGenerated() { diff --git a/patches/server/Replace-player-chunk-loader-system.patch b/patches/server/Replace-player-chunk-loader-system.patch index 0eef644414..850037edeb 100644 --- a/patches/server/Replace-player-chunk-loader-system.patch +++ b/patches/server/Replace-player-chunk-loader-system.patch @@ -1445,8 +1445,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - }); + // Paper - no-tick view distance - moved to Chunk neighbour update }); - }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading - return completablefuture1; + }, (runnable) -> { + this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int k = this.viewDistance;