the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 48 lines 1.6 kB view raw
1#pragma once 2#include "..\Minecraft.World\net.minecraft.world.level.h" 3#include "..\Minecraft.World\net.minecraft.world.level.chunk.h" 4#include "..\Minecraft.World\RandomLevelSource.h" 5 6using namespace std; 7class ServerChunkCache; 8 9// 4J - various alterations here to make this thread safe, and operate as a fixed sized cache 10class MultiPlayerChunkCache : public ChunkSource 11{ 12 friend class LevelRenderer; 13private: 14 LevelChunk *emptyChunk; 15 LevelChunk *waterChunk; 16 17 vector<LevelChunk *> loadedChunkList; 18 19 LevelChunk **cache; 20 // 4J - added for multithreaded support 21 CRITICAL_SECTION m_csLoadCreate; 22 // 4J - size of cache is defined by size of one side - must be even 23 int XZSIZE; 24 int XZOFFSET; 25 bool *hasData; 26 27 Level *level; 28 29public: 30 MultiPlayerChunkCache(Level *level); 31 ~MultiPlayerChunkCache(); 32 virtual bool hasChunk(int x, int z); 33 virtual bool reallyHasChunk(int x, int z); 34 virtual void drop(int x, int z); 35 virtual LevelChunk *create(int x, int z); 36 virtual LevelChunk *getChunk(int x, int z); 37 virtual bool save(bool force, ProgressListener *progressListener); 38 virtual bool tick(); 39 virtual bool shouldSave(); 40 virtual void postProcess(ChunkSource *parent, int x, int z); 41 virtual wstring gatherStats(); 42 virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z); 43 virtual TilePos *findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z); 44 virtual void recreateLogicStructuresForChunk(int chunkX, int chunkZ); 45 virtual void dataReceived(int x, int z); // 4J added 46 47 virtual LevelChunk **getCache() { return cache; } // 4J added 48};