151 virtual void Execute(
void)
override;
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
Wraps the chunk coords into a single structure.
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
Interface class used as a callback for operations that involve chunk coords.
Takes requests for generating chunks and processes them in a separate thread one by one.
cEvent m_evtRemoved
Set when an item is removed from the queue.
size_t GetQueueLength() const
Queue m_Queue
Queue of the chunks to be generated.
cEvent m_Event
Set when an item is added to the queue or the thread should terminate.
virtual void Execute(void) override
This function, overloaded by the descendants, is called in the new thread.
bool Initialize(cPluginInterface &a_PluginInterface, cChunkSink &a_ChunkSink, cIniFile &a_IniFile)
Read settings from the ini file and initialize in preperation for being started.
std::list< QueueItem > Queue
cChunkSink * m_ChunkSink
The destination where the generated chunks are sent.
cCriticalSection m_CS
CS protecting access to the queue.
cChunkGeneratorThread(void)
EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ)
Returns the biome at the specified coords.
void DoGenerate(cChunkCoords a_Coords)
Generates the specified chunk and sets it into the chunksink.
void GenerateBiomes(cChunkCoords a_Coords, cChunkDef::BiomeMap &a_BiomeMap)
Generates the biomes for the specified chunk (directly, not in a separate thread).
std::unique_ptr< cChunkGenerator > m_Generator
The actual chunk generator engine used.
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.
virtual ~cChunkGeneratorThread() override
The interface through which the plugins are called for their OnChunkGenerating / OnChunkGenerated hoo...
virtual ~cPluginInterface()
virtual void CallHookChunkGenerated(cChunkDesc &a_ChunkDesc)=0
Called after the chunk is generated, before it is handed to the chunk sink.
virtual void CallHookChunkGenerating(cChunkDesc &a_ChunkDesc)=0
Called when the chunk is about to be generated.
The interface through which the generated chunks are handed to the cWorld or whoever created us.
virtual bool HasChunkAnyClients(cChunkCoords a_Coords)=0
Called when the generator is overloaded to skip chunks that are no longer needed.
virtual bool IsChunkValid(cChunkCoords a_Coords)=0
Called just before the chunk generation is started, to verify that it hasn't been generated in the me...
virtual void OnChunkGenerated(cChunkDesc &a_ChunkDesc)=0
Called after the chunk has been generated The interface may store the chunk, send it over network,...
virtual bool IsChunkQueued(cChunkCoords a_Coords)=0
Called to check whether the specified chunk is in the queued state.
QueueItem(cChunkCoords a_Coords, bool a_ForceRegeneration, cChunkCoordCallback *a_Callback)
cChunkCoordCallback * m_Callback
Callback to call after generating.
bool m_ForceRegeneration
Force the regeneration of an already existing chunk.
cChunkCoords m_Coords
The chunk coords.
The interface that all chunk generators must implement to provide the generated chunks.
cIsThread(AString &&a_ThreadName)