aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjarne Koll <[email protected]>2022-09-29 17:54:47 +0200
committerGitHub <[email protected]>2022-09-29 08:54:47 -0700
commit8a7dd613487ea3abe0180fdf95ecaadbaa2144a6 (patch)
treef4ca8c8d7bb529701347f356e7028cd935715b9e
parent017af785ff3ca4925e91f9e1b9a2cf7b2a26b6e7 (diff)
downloadPaper-8a7dd613487ea3abe0180fdf95ecaadbaa2144a6.tar.gz
Paper-8a7dd613487ea3abe0180fdf95ecaadbaa2144a6.zip
Mark parsed PoiChunks with data as not loaded (#8405)
Previously, PoiChunk#empty would create a new empty poi chunk with loaded already set to true, as no data was contained in the chunk. This allowed the poi chunk to skip expensive trips to the main thread. However, PoiChunk#parse used #empty to create the initial PoiChunk instance that is then filled with data. This leads to PoiChunks returned from #parse to already be marked as loaded, preventing the then needed trip to the tick thread to update things like the village distance tracker. To fix this, this commit now marks the PoiChunks loaded state as false if the parse logic actually read and parsed any data. This allows the PoiChunk#load method to properly run its callbacks when called for the first time.
-rw-r--r--patches/server/0016-Rewrite-chunk-system.patch6
1 files changed, 4 insertions, 2 deletions
diff --git a/patches/server/0016-Rewrite-chunk-system.patch b/patches/server/0016-Rewrite-chunk-system.patch
index 3f2585cc65..3cd52368ed 100644
--- a/patches/server/0016-Rewrite-chunk-system.patch
+++ b/patches/server/0016-Rewrite-chunk-system.patch
@@ -4902,10 +4902,10 @@ index 0000000000000000000000000000000000000000..0b7a2b0ead4f3bc07bfd9a38c2b7cf02
+}
diff --git a/src/main/java/io/papermc/paper/chunk/system/poi/PoiChunk.java b/src/main/java/io/papermc/paper/chunk/system/poi/PoiChunk.java
new file mode 100644
-index 0000000000000000000000000000000000000000..b1bdd79044c00635c836dbed327526136ca4bd4e
+index 0000000000000000000000000000000000000000..1695ef1d1ed2e067665431063fbca7f51873af32
--- /dev/null
+++ b/src/main/java/io/papermc/paper/chunk/system/poi/PoiChunk.java
-@@ -0,0 +1,211 @@
+@@ -0,0 +1,213 @@
+package io.papermc.paper.chunk.system.poi;
+
+import com.mojang.logging.LogUtils;
@@ -5114,6 +5114,8 @@ index 0000000000000000000000000000000000000000..b1bdd79044c00635c836dbed32752613
+ ret.sections[sectionY - ret.minSection] = deserialized;
+ }
+
++ ret.loaded = !readAnything; // Set loaded to false if we read anything to ensure proper callbacks to PoiManager are made on #load
++
+ return ret;
+ }
+}