From f044bd9e6c7385245854bfbc69b841a6ae4296d9 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Thu, 29 Sep 2022 17:54:47 +0200 Subject: [PATCH] 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. --- patches/server/Rewrite-chunk-system.patch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 4a31226d99..98ad3f35b7 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -5114,6 +5114,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; + } +}