the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 57 lines 1.7 kB view raw
1#pragma once 2#include "ChunkStorage.h" 3#include "LevelChunk.h" 4#include "File.h" 5#include "CompoundTag.h" 6#include "com.mojang.nbt.h" 7 8class Level; 9 10class OldChunkStorage : public ChunkStorage 11{ 12private: 13 // 4J added so we can have separate storage arrays for different threads 14 class ThreadStorage 15 { 16 public: 17 byteArray blockData; 18 byteArray dataData; 19 byteArray skyLightData; 20 byteArray blockLightData; 21 22 ThreadStorage(); 23 ~ThreadStorage(); 24 }; 25 static DWORD tlsIdx; 26 static ThreadStorage *tlsDefault; 27public: 28 // Each new thread that needs to use Compression will need to call one of the following 2 functions, to either create its own 29 // local storage, or share the default storage already allocated by the main thread 30 static void CreateNewThreadStorage(); 31 static void UseDefaultThreadStorage(); 32 static void ReleaseThreadStorage(); 33 34private: 35 File dir; 36 bool create; 37 38public: 39 OldChunkStorage(File dir, bool create); 40private: 41 File getFile(int x, int z); 42 LevelChunk *load(Level *level, int x, int z); 43 44public: 45 virtual void save(Level *level, LevelChunk *levelChunk); 46 47 static bool saveEntities(LevelChunk *lc, Level *level, CompoundTag *tag); // 4J Added 48 static void save(LevelChunk *lc, Level *level, DataOutputStream *dos); // 4J Added 49 static void save(LevelChunk *lc, Level *level, CompoundTag *tag); 50 static void loadEntities(LevelChunk *lc, Level *level, CompoundTag *tag); 51 static LevelChunk *load(Level *level, CompoundTag *tag); 52 static LevelChunk *load(Level *level, DataInputStream *dis); // 4J Added 53 54 virtual void tick(); 55 virtual void flush(); 56 virtual void saveEntities(Level *level, LevelChunk *levelChunk); 57};