summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-22 22:21:47 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-09-25 15:51:16 +0200
commit4519469547c0f8befe74e3e80a94efb0e076ba34 (patch)
treeb2e020631d1fbbfe0225d1c6a6a88dbc6eab124b /src/ChunkMap.cpp
parentGrass spread: check chunk & light validity correctly (diff)
downloadcuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.tar
cuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.tar.gz
cuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.tar.bz2
cuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.tar.lz
cuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.tar.xz
cuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.tar.zst
cuberite-4519469547c0f8befe74e3e80a94efb0e076ba34.zip
Diffstat (limited to '')
-rw-r--r--src/ChunkMap.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 71b8a7a24..53bb905a6 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -1717,10 +1717,17 @@ void cChunkMap::UnloadUnusedChunks(void)
for (auto itr = m_Chunks.begin(); itr != m_Chunks.end();)
{
if (
- (itr->second.CanUnload()) && // Can unload
+ itr->second.CanUnload() && // Can unload
!cPluginManager::Get()->CallHookChunkUnloading(*GetWorld(), itr->first.ChunkX, itr->first.ChunkZ) // Plugins agree
)
{
+ // First notify plugins:
+ cPluginManager::Get()->CallHookChunkUnloaded(*m_World, itr->first.ChunkX, itr->first.ChunkZ);
+
+ // Notify entities within the chunk, while everything's still valid:
+ itr->second.OnUnload();
+
+ // Kill the chunk:
itr = m_Chunks.erase(itr);
}
else