8 #include "../IniFile.h"
9 #include "../FastRandom.h"
18 if (a_IniFile.
HasValue(
"Seed",
"Seed"))
39 std::unique_ptr<cChunkGenerator> res;
49 LOGWARN(
"[Generator]::Generator value \"%s\" not recognized, using \"Composable\".", GeneratorName.c_str());
56 LOGERROR(
"Generator could not start, aborting the server");
60 res->Initialize(a_IniFile);
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
eDimension StringToDimension(const AString &a_DimensionString)
Translates a dimension string to dimension enum.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
void LOGERROR(std::string_view a_Format, const Args &... args)
void LOGINFO(std::string_view a_Format, const Args &... args)
int NoCaseCompare(const AString &s1, const AString &s2)
Case-insensitive string comparison.
static void AbsoluteToRelative(int &a_X, int &a_Y, int &a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords into relative (chunk + block) coords:
static EMCSBiome GetBiome(const BiomeMap &a_BiomeMap, int a_X, int a_Z)
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
IntType RandInt(IntType a_Min, IntType a_Max)
Return a random IntType in the range [a_Min, a_Max].
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.
static std::unique_ptr< cChunkGenerator > CreateFromIniFile(cIniFile &a_IniFile)
Creates and initializes the entire generator based on the settings in the INI file.
bool HasValue(const AString &a_KeyName, const AString &a_ValueName) const override
Returns true iff the specified value exists.
AString GetValue(const AString &keyname, const AString &valuename, const AString &defValue="") const override
Get the value at the specified key and value, returns defValue on failure.
int GetValueI(const AString &keyname, const AString &valuename, const int defValue=0) const
bool SetValueI(const AString &a_KeyName, const AString &a_ValueName, const int a_Value, const bool a_CreateIfNotExists=true) override
AString GetValueSet(const AString &keyname, const AString &valuename, const AString &defValue="") override
Gets the value; if not found, write the default to the repository.