59 virtual void OnChunkGenerated(
cChunkDesc & a_ChunkDesc) = 0;
68 virtual bool HasChunkAnyClients(
cChunkCoords a_Coords) = 0;
119 m_ForceRegeneration(a_ForceRegeneration),
120 m_Callback(a_Callback)
151 virtual void Execute(
void)
override;
virtual ~cChunkGeneratorThread() override
QueueItem(cChunkCoords a_Coords, bool a_ForceRegeneration, cChunkCoordCallback *a_Callback)
cChunkSink * m_ChunkSink
The destination where the generated chunks are sent.
EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ)
Returns the biome at the specified coords.
The interface through which the plugins are called for their OnChunkGenerating / OnChunkGenerated hoo...
Queue m_Queue
Queue of the chunks to be generated.
cChunkCoordCallback * m_Callback
Callback to call after generating.
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
cCriticalSection m_CS
CS protecting access to the queue.
void QueueGenerateChunk(cChunkCoords a_Coords, bool a_ForceRegeneration, cChunkCoordCallback *a_Callback=nullptr)
Queues the chunk for generation If a-ForceGenerate is set, the chunk is regenerated even if the data ...
cPluginInterface * m_PluginInterface
The plugin interface that may modify the generated chunks.
Takes requests for generating chunks and processes them in a separate thread one by one...
bool Initialize(cPluginInterface &a_PluginInterface, cChunkSink &a_ChunkSink, cIniFile &a_IniFile)
Read settings from the ini file and initialize in preperation for being started.
virtual void CallHookChunkGenerating(cChunkDesc &a_ChunkDesc)=0
Called when the chunk is about to be generated.
virtual ~cPluginInterface()
void DoGenerate(cChunkCoords a_Coords)
Generates the specified chunk and sets it into the chunksink.
bool m_ForceRegeneration
Force the regeneration of an already existing chunk.
virtual void Execute(void) override
This is the main thread entrypoint.
virtual void CallHookChunkGenerated(cChunkDesc &a_ChunkDesc)=0
Called after the chunk is generated, before it is handed to the chunk sink.
std::unique_ptr< cChunkGenerator > m_Generator
The actual chunk generator engine used.
cChunkCoords m_Coords
The chunk coords.
int GetQueueLength() const
cEvent m_Event
Set when an item is added to the queue or the thread should terminate.
Interface class used as a callback for operations that involve chunk coords.
void GenerateBiomes(cChunkCoords a_Coords, cChunkDef::BiomeMap &a_BiomeMap)
Generates the biomes for the specified chunk (directly, not in a separate thread).
std::list< QueueItem > Queue
The interface through which the generated chunks are handed to the cWorld or whoever created us...
cEvent m_evtRemoved
Set when an item is removed from the queue.
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
The interface that all chunk generators must implement to provide the generated chunks.
cChunkGeneratorThread(void)
cIsThread(const AString &a_ThreadName)