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