Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
cChunkGenerator Class Referenceabstract

The interface that all chunk generators must implement to provide the generated chunks. More...

#include <ChunkGenerator.h>

Inheritance diagram for cChunkGenerator:
Inheritance graph
[legend]

Public Member Functions

virtual void Generate (cChunkDesc &a_ChunkDesc)=0
 Does the actual chunk generation. More...
 
virtual void GenerateBiomes (cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap &a_BiomeMap)=0
 Generates the biomes for the specified chunk. More...
 
virtual EMCSBiome GetBiomeAt (int a_BlockX, int a_BlockZ)
 Returns the biome at the specified coords. More...
 
int GetSeed (void) const
 Returns the seed that was read from the INI file. More...
 
virtual void Initialize (cIniFile &a_IniFile)
 Called to initialize the generator on server startup. More...
 
virtual ~cChunkGenerator ()
 

Static Public Member Functions

static std::unique_ptr< cChunkGeneratorCreateFromIniFile (cIniFile &a_IniFile)
 Creates and initializes the entire generator based on the settings in the INI file. More...
 

Protected Attributes

eDimension m_Dimension
 The dimension, read from the INI file. More...
 
int m_Seed
 The main seed, read from the INI file, used for the entire generator. More...
 

Detailed Description

The interface that all chunk generators must implement to provide the generated chunks.

Also a static factory that creates the descendants based on INI file settings. The cChunkGeneratorThread uses this interface to generate chunks for a single world. Ths calls to generate chunks are synchronous - they don't return until the chunk is fully generated.

Definition at line 20 of file ChunkGenerator.h.

Constructor & Destructor Documentation

◆ ~cChunkGenerator()

virtual cChunkGenerator::~cChunkGenerator ( )
inlinevirtual

Definition at line 23 of file ChunkGenerator.h.

Member Function Documentation

◆ CreateFromIniFile()

std::unique_ptr< cChunkGenerator > cChunkGenerator::CreateFromIniFile ( cIniFile a_IniFile)
static

Creates and initializes the entire generator based on the settings in the INI file.

Initializes the generator, so that it can be used immediately after this call returns.

Definition at line 36 of file ChunkGenerator.cpp.

◆ Generate()

virtual void cChunkGenerator::Generate ( cChunkDesc a_ChunkDesc)
pure virtual

Does the actual chunk generation.

Descendants need to override this and generate into a_ChunkDesc.

Implemented in cNoise3DGenerator, and cComposableGenerator.

◆ GenerateBiomes()

virtual void cChunkGenerator::GenerateBiomes ( cChunkCoords  a_ChunkCoords,
cChunkDef::BiomeMap a_BiomeMap 
)
pure virtual

Generates the biomes for the specified chunk.

Used by the world loader if biomes failed loading.

Implemented in cNoise3DGenerator, and cComposableGenerator.

◆ GetBiomeAt()

EMCSBiome cChunkGenerator::GetBiomeAt ( int  a_BlockX,
int  a_BlockZ 
)
virtual

Returns the biome at the specified coords.

Used by ChunkMap if an invalid chunk is queried for biome. The default implementation uses GenerateBiomes().

Definition at line 68 of file ChunkGenerator.cpp.

◆ GetSeed()

int cChunkGenerator::GetSeed ( void  ) const
inline

Returns the seed that was read from the INI file.

Definition at line 43 of file ChunkGenerator.h.

◆ Initialize()

void cChunkGenerator::Initialize ( cIniFile a_IniFile)
virtual

Called to initialize the generator on server startup.

Descendants should call Super::Initialize() before initializing themselves.

Reimplemented in cNoise3DGenerator, and cComposableGenerator.

Definition at line 15 of file ChunkGenerator.cpp.

Member Data Documentation

◆ m_Dimension

eDimension cChunkGenerator::m_Dimension
protected

The dimension, read from the INI file.

Definition at line 56 of file ChunkGenerator.h.

◆ m_Seed

int cChunkGenerator::m_Seed
protected

The main seed, read from the INI file, used for the entire generator.

Definition at line 53 of file ChunkGenerator.h.


The documentation for this class was generated from the following files: