From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/McRegionChunkStorage.h | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Minecraft.World/McRegionChunkStorage.h (limited to 'Minecraft.World/McRegionChunkStorage.h') 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 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); +}; -- cgit v1.2.3