diff --git a/patches/server/Use-updatingChunks-for-flush-saving.patch b/patches/server/Use-updatingChunks-for-flush-saving.patch new file mode 100644 index 0000000000..9017b980c9 --- /dev/null +++ b/patches/server/Use-updatingChunks-for-flush-saving.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Tue, 31 Aug 2021 17:12:01 -0700 +Subject: [PATCH] Use updatingChunks for flush saving + + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- 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 + } + // Paper end + ++ // Paper start ++ public Long2ObjectLinkedOpenHashMap getVisibleChunks() { ++ synchronized (this.updatingChunks) { ++ return this.updatingChunks.getVisibleMap().clone(); ++ } ++ } ++ // Paper end ++ + protected void saveAllChunks(boolean flush) { + if (flush) { +- List list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); ++ List list = (List) this.getVisibleChunks().values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper + MutableBoolean mutableboolean = new MutableBoolean(); + + do {