Files
MinecraftConsoles/Minecraft.Client/MultiPlayerChunkCache.h
daoge b3feddfef3 feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
2026-03-03 03:04:10 +08:00

48 lines
1.6 KiB
C++

#pragma once
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "..\Minecraft.World\net.minecraft.world.level.chunk.h"
#include "..\Minecraft.World\RandomLevelSource.h"
using namespace std;
class ServerChunkCache;
// 4J - various alterations here to make this thread safe, and operate as a fixed sized cache
class MultiPlayerChunkCache : public ChunkSource
{
friend class LevelRenderer;
private:
LevelChunk *emptyChunk;
LevelChunk *waterChunk;
vector<LevelChunk *> loadedChunkList;
LevelChunk **cache;
// 4J - added for multithreaded support
CRITICAL_SECTION m_csLoadCreate;
// 4J - size of cache is defined by size of one side - must be even
int XZSIZE;
int XZOFFSET;
bool *hasData;
Level *level;
public:
MultiPlayerChunkCache(Level *level);
~MultiPlayerChunkCache();
virtual bool hasChunk(int x, int z);
virtual bool reallyHasChunk(int x, int z);
virtual void drop(int x, int z);
virtual LevelChunk *create(int x, int z);
virtual LevelChunk *getChunk(int x, int z);
virtual bool save(bool force, ProgressListener *progressListener);
virtual bool tick();
virtual bool shouldSave();
virtual void postProcess(ChunkSource *parent, int x, int z);
virtual wstring gatherStats();
virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z);
virtual TilePos *findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z);
virtual void recreateLogicStructuresForChunk(int chunkX, int chunkZ);
virtual void dataReceived(int x, int z); // 4J added
virtual LevelChunk **getCache() { return cache; } // 4J added
};