Cuberite
A lightweight, fast and extensible game server for Minecraft
ChunkGenerator.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 
5 
6 
7 // fwd:
8 class cIniFile;
9 class cChunkDesc;
10 
11 
12 
13 
14 
20 {
21 public:
22  virtual ~cChunkGenerator() {} // Force a virtual destructor
23 
26  virtual void Initialize(cIniFile & a_IniFile);
27 
30  virtual void GenerateBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) = 0;
31 
35  virtual EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ);
36 
39  virtual void Generate(cChunkDesc & a_ChunkDesc) = 0;
40 
42  int GetSeed(void) const { return m_Seed; }
43 
46  static std::unique_ptr<cChunkGenerator> CreateFromIniFile(cIniFile & a_IniFile);
47 
48 
49 protected:
50 
52  int m_Seed;
53 
56 };
57 
58 
59 
60 
virtual void Initialize(cIniFile &a_IniFile)
Called to initialize the generator on server startup.
eDimension
Dimension of a world.
Definition: BlockID.h:1127
virtual EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ)
Returns the biome at the specified coords.
virtual void Generate(cChunkDesc &a_ChunkDesc)=0
Does the actual chunk generation.
int m_Seed
The main seed, read from the INI file, used for the entire generator.
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
Definition: BiomeDef.h:21
eDimension m_Dimension
The dimension, read from the INI file.
virtual void GenerateBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap &a_BiomeMap)=0
Generates the biomes for the specified chunk.
static std::unique_ptr< cChunkGenerator > CreateFromIniFile(cIniFile &a_IniFile)
Creates and initializes the entire generator based on the settings in the INI file.
int GetSeed(void) const
Returns the seed that was read from the INI file.
virtual ~cChunkGenerator()
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
Definition: ChunkDef.h:147
The interface that all chunk generators must implement to provide the generated chunks.