From 14be4180f6651e3622050e8072b7dd7a88348c94 Mon Sep 17 00:00:00 2001 From: Jason <11360596+jpenilla@users.noreply.github.com> Date: Tue, 31 Aug 2021 19:23:22 -0500 Subject: [PATCH] Use updatingChunks for flush saving (#6533) --- ...-Use-updatingChunks-for-flush-saving.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/server/0802-Use-updatingChunks-for-flush-saving.patch diff --git a/patches/server/0802-Use-updatingChunks-for-flush-saving.patch b/patches/server/0802-Use-updatingChunks-for-flush-saving.patch new file mode 100644 index 0000000000..86defd449d --- /dev/null +++ b/patches/server/0802-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 d9f1601c49e7e7fc06a6f9bf0cb13aacd66f190c..59073cbae4ff8d8c38934a6d0ea11545a30a7013 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -950,9 +950,17 @@ 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 {