aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/McRegionChunkStorage.h
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/McRegionChunkStorage.h
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/McRegionChunkStorage.h')
-rw-r--r--Minecraft.World/McRegionChunkStorage.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/Minecraft.World/McRegionChunkStorage.h b/Minecraft.World/McRegionChunkStorage.h
new file mode 100644
index 00000000..50dabd52
--- /dev/null
+++ b/Minecraft.World/McRegionChunkStorage.h
@@ -0,0 +1,43 @@
+#pragma once
+using namespace std;
+
+#include "ChunkStorage.h"
+#include "LevelChunk.h"
+#include "RegionFileCache.h"
+#include "com.mojang.nbt.h"
+#include "OldChunkStorage.h"
+
+class ConsoleSaveFile;
+
+class McRegionChunkStorage : public ChunkStorage
+{
+private:
+ const wstring m_prefix;
+ ConsoleSaveFile *m_saveFile;
+ static CRITICAL_SECTION cs_memory;
+
+ unordered_map<__int64, byteArray> m_entityData;
+
+ static std::deque<DataOutputStream *> s_chunkDataQueue;
+ static int s_runningThreadCount;
+ static C4JThread *s_saveThreads[3];
+
+public:
+ McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstring &prefix);
+ ~McRegionChunkStorage();
+ static void staticCtor();
+
+ virtual LevelChunk *load(Level *level, int x, int z);
+ virtual void save(Level *level, LevelChunk *levelChunk);
+ virtual void saveEntities(Level *level, LevelChunk *levelChunk);
+ virtual void loadEntities(Level *level, LevelChunk *levelChunk);
+ virtual void tick();
+ virtual void flush();
+ virtual void WaitForAll(); // 4J Added
+ virtual void WaitIfTooManyQueuedChunks(); // 4J Added
+
+private:
+ static void WaitForAllSaves();
+ static void WaitForSaves();
+ static int runSaveThreadProc(LPVOID lpParam);
+};