13 #include "../Simulator/FluidSimulator.h"
14 #include "../Simulator/FireSimulator.h"
15 #include "../IniFile.h"
16 #include "../MobSpawner.h"
17 #include "../BlockInfo.h"
23 #define DEF_NETHER_WATER_SPRINGS "0, 1; 255, 1"
24 #define DEF_NETHER_LAVA_SPRINGS "0, 0; 30, 0; 31, 50; 120, 50; 127, 0"
25 #define DEF_OVERWORLD_WATER_SPRINGS "0, 0; 10, 10; 11, 75; 16, 83; 20, 83; 24, 78; 32, 62; 40, 40; 44, 15; 48, 7; 56, 2; 64, 1; 255, 0"
26 #define DEF_OVERWORLD_LAVA_SPRINGS "0, 0; 10, 5; 11, 45; 48, 2; 64, 1; 255, 0"
27 #define DEF_END_WATER_SPRINGS "0, 1; 255, 1"
28 #define DEF_END_LAVA_SPRINGS "0, 1; 255, 1"
29 #define DEF_ANIMAL_SPAWN_PERCENT 10
30 #define DEF_NO_ANIMALS 0
96 int MinX = a_RelX - 4;
102 int MaxX = a_RelX + 4;
108 int MinZ = a_RelZ - 4;
114 int MaxZ = a_RelZ + 4;
120 int MinY = a_RelY - 2;
126 int MaxY = a_RelY + 2;
132 for (
int x = MinX; x < MaxX; x++)
135 for (
int z = MinZ; z < MaxZ; z++)
138 for (
int y = MinY; y < MaxY; y++)
194 const auto & PossibleBlocks = info.
m_Blocks;
195 if (PossibleBlocks.empty())
208 for (
int i = 0; i < NumClumps; i++)
218 for (
const auto &
Block : PossibleBlocks)
220 TotalWeight +=
Block.m_Weight;
224 TotalWeight = (TotalWeight != 0) ? TotalWeight : 1;
225 int Weight = BlockVal % TotalWeight;
226 for (
const auto &
Block : PossibleBlocks)
228 Weight -=
Block.m_Weight;
248 for (
int i = 1; i < NumBlocks; i++)
261 auto GroundBlockType = a_ChunkDesc.
GetBlockType(x, Top, z);
290 for (
int i =
static_cast<int>(a_Output.size()); i <=
static_cast<int>(
biMaxVariantBiome); i++)
293 a_Output.emplace_back();
299 if (ClumpInfo.size() != 2)
301 LOGWARNING(
"OverworldClumpFoliage: Data missing for \"%s\". Please divide biome and blocks with a semi colon", a_RawClumpInfo.c_str());
308 for (
const auto & RawBiomeInfo : Biomes)
315 LOGWARNING(
"Biome \"%s\" is invalid.", BiomeName.c_str());
320 const size_t BiomeIndex =
static_cast<size_t>(Biome);
328 LOGWARNING(
"OverworldClumpFoliage: Invalid data in \"%s\". Second parameter is either not existing or a number", RawBiomeInfo.c_str());
331 a_Output[BiomeIndex].m_MinNumClumpsPerChunk = MinNumClump;
334 a_Output[BiomeIndex].m_MaxNumClumpsPerChunk = std::max(MinNumClump, a_Output[BiomeIndex].m_MaxNumClumpsPerChunk);
339 int MinNumClumps = 0, MaxNumClumps = 1;
342 LOGWARNING(
"Invalid data in \"%s\". Second parameter is either not existing or a number", RawBiomeInfo.c_str());
346 a_Output[BiomeIndex].m_MaxNumClumpsPerChunk = MaxNumClumps + 1;
347 a_Output[BiomeIndex].m_MinNumClumpsPerChunk = MinNumClumps;
351 for (
const auto & BlockName : Blocks)
356 LOGWARNING(
"Block \"%s\" is invalid", BlockName.c_str());
361 a_Output[BiomeIndex].m_Blocks.emplace_back(
374 std::vector<cFinishGenClumpTopBlock::BiomeInfo> Foliage;
375 int NumGeneratorValues = a_IniFile.
GetNumValues(
"Generator");
376 int GeneratorKeyId = a_IniFile.
FindKey(
"Generator");
377 for (
int i = 0; i < NumGeneratorValues; i++)
380 if (ValueName.substr(0, a_ClumpPrefix.size()) == a_ClumpPrefix)
417 for (
int i = 1; i <= NumGlowStone; i++)
426 int Height = a_ChunkDesc.
GetHeight(X, Z);
427 for (
int y = Height; y > Size; y--)
463 const Vector3i AvailableDirections[] =
465 { -1, 0, 0 }, { 1, 0, 0 },
467 { 0, 0, -1 }, { 0, 0, 1 },
471 { 0, -1, 1 }, { 1, -1, 0 },
472 { 0, -1, -1 }, { -1, -1, 0 },
476 for (
int i = 1; i <= a_NumStrings; i++)
485 for (
int j = 0; j < a_Size; j++)
490 while (
Direction.Equals(PreviousDirection))
546 auto BlockBelow = a_ChunkDesc.
GetBlockType(x, y - 1, z);
782 int Height = a_ChunkDesc.
GetHeight(x, z);
783 for (
int y = Height; y >
m_Level; y--)
796 std::vector<NIBBLETYPE> Places;
817 if (Places.size() == 0)
860 for (
int i = 0; i < CactusHeight; i++)
862 const bool cactusExists = i != 0;
864 const int y = a_RelY + 1;
890 switch (a_ChunkDesc.
GetBlockType(a_RelX, a_RelY, a_RelZ))
932 for (
int i = 0; i < SugarcaneHeight; i++)
953 const float zz =
static_cast<float>(BlockZ);
974 const float xx =
static_cast<float>(BlockX);
985 else if ((val1 > 0.5) && (val2 < -0.5))
995 if (val1 + val2 > 0.5f)
1041 for (
int x = 0; x < 16; x++)
1043 int xx = ChunkX + x;
1044 for (
int z = 0; z < 16; z++)
1046 int zz = ChunkZ + z;
1049 for (
int y = 2; y < MaxHeight - 2; y++)
1108 a_ChunkDesc.
SetHeight(x, z, Height + 1);
1127 int Height = a_ChunkDesc.
GetHeight(x, z);
1161 for (
size_t i = 0; i <
ARRAYCOUNT(a_BiomeMap); i++)
1180 for (
int i = 0; i < NumToGen; i++)
1212 a_ChunkDesc.
SetHeight(x, z, Height + 1);
1226 for (
int y =
m_Level; y > 0; y--)
1247 m_PreSimulateFallingBlocks(a_PreSimulateFallingBlocks),
1248 m_PreSimulateWater(a_PreSimulateWater),
1249 m_PreSimulateLava(a_PreSimulateLava)
1326 if (LastY > HeightY)
1358 if ((
Block != a_Fluid) && (
Block != a_StationaryFluid))
1373 BLOCKTYPE BlockToSet = a_StationaryFluid;
1374 for (
size_t i = 0; i <
ARRAYCOUNT(Coords); i++)
1376 if ((y == 0) && (Coords[i].y < 0))
1384 BlockToSet = a_Fluid;
1426 m_Noise(a_Seed + a_Fluid * 100),
1427 m_HeightDistribution(
cChunkDef::Height - 1),
1432 AString DefaultHeightDistribution;
1433 int DefaultChance = 0;
1434 switch (a_Dimension)
1439 DefaultChance =
IsWater ? 0 : 15;
1445 DefaultChance =
IsWater ? 24 : 9;
1456 ASSERT(!
"Unhandled world dimension");
1460 AString HeightDistribution = a_IniFile.
GetValueSet(SectionName,
"HeightDistribution", DefaultHeightDistribution);
1463 LOGWARNING(
"[%sSprings]: HeightDistribution is invalid, using the default of \"%s\".",
1465 DefaultHeightDistribution.c_str()
1491 for (
int y = Height; y > 1; y--)
1539 int NumAirNeighbors = 0;
1540 for (
size_t i = 0; i <
ARRAYCOUNT(Coords); i++)
1542 switch (a_ChunkDesc.
GetBlockType(x + Coords[i].x, y + Coords[i].y, z + Coords[i].z))
1546 NumAirNeighbors += 1;
1547 if (NumAirNeighbors > 1)
1554 if (NumAirNeighbors == 0)
1574 AString SectionName =
"Animals";
1576 switch (a_Dimension)
1591 ASSERT(!
"Unhandled world dimension");
1599 LOGWARNING(
"[Animals]: AnimalSpawnChunkPercentage is invalid, using the default of \"%d\".", DefaultAnimalSpawnChunkPercentage);
1626 for (
int Tries = 0; Tries < 10; Tries++)
1630 if (
TrySpawnAnimals(a_ChunkDesc, PackCenterX, a_ChunkDesc.
GetHeight(PackCenterX, PackCenterZ), PackCenterZ, RandomMob))
1632 for (
int i = 0; i < 3; i++)
1686 double AnimalY = a_RelY;
1690 NewMob->SetHealth(NewMob->GetMaxHealth());
1691 NewMob->SetPosition(AnimalX, AnimalY, AnimalZ);
1692 FLOGD(
"Spawning {0} #{1} at {2:.02f}", NewMob->GetClass(), NewMob->GetUniqueID(), NewMob->GetPosition());
1693 a_ChunkDesc.
GetEntities().emplace_back(std::move(NewMob));
1704 std::vector<eMonsterType> ListOfSpawnables;
1714 ListOfSpawnables.push_back(MobType);
1718 if (ListOfSpawnables.empty())
1723 auto RandMob = (
static_cast<size_t>(
m_Noise.
IntNoise2DInt(chunkX - chunkZ + 2, chunkX + 5) / 7) % ListOfSpawnables.size());
1724 return ListOfSpawnables[RandMob];
1743 ore.m_BlockType, ore.m_BlockMeta,
1744 ore.m_MaxHeight, ore.m_NumNests, ore.m_NestSize,
1815 for (
const auto & ore: ores)
1818 if (parts.size() != 5)
1820 LOGWARNING(
"Cannot parse ore information from string, not enough OreInfo members (exp 5, got %d). Offending item: \"%s\".",
1821 static_cast<unsigned>(parts.size()), ore.c_str()
1828 LOGWARNING(
"Cannot parse ore information from string, invalid OreType: \"%s\".", parts[0].c_str());
1832 int maxHeight, numNests, nestSize;
1840 LOGWARNING(
"Cannot parse ore information from string, invalid number in OreInfo \"%s\".", ore.c_str());
1843 res.emplace_back(
static_cast<BLOCKTYPE>(oreType), oreMeta, maxHeight, numNests, nestSize);
1855 for (
const auto & ore: a_OreInfos)
1861 res.append(fmt::format(FMT_STRING(
"{}:{}:{}:{}:{}"),
1863 ore.m_MaxHeight, ore.m_NumNests, ore.m_NestSize
1888 int a_MaxHeight,
int a_NumNests,
int a_NestSize,
1900 const auto BiomeSampleOne = a_ChunkDesc.
GetBiome( 4, 4);
1901 const auto BiomeSampleTwo = a_ChunkDesc.
GetBiome( 4, 12);
1902 const auto BiomeSampleThree = a_ChunkDesc.
GetBiome(12, 4);
1903 const auto BiomeSampleFour = a_ChunkDesc.
GetBiome(12, 12);
1920 const auto BiomeSampleOne = a_ChunkDesc.
GetBiome( 4, 4);
1921 const auto BiomeSampleTwo = a_ChunkDesc.
GetBiome( 4, 12);
1922 const auto BiomeSampleThree = a_ChunkDesc.
GetBiome(12, 4);
1923 const auto BiomeSampleFour = a_ChunkDesc.
GetBiome(12, 12);
1939 const auto BiomeSampleOne = a_ChunkDesc.
GetBiome( 4, 4);
1940 const auto BiomeSampleTwo = a_ChunkDesc.
GetBiome( 4, 12);
1941 const auto BiomeSampleThree = a_ChunkDesc.
GetBiome(12, 4);
1942 const auto BiomeSampleFour = a_ChunkDesc.
GetBiome(12, 12);
1959 for (
int i = 0; i < a_NumNests; i++)
1966 int BaseY = nestRnd % a_MaxHeight;
1967 nestRnd /= a_MaxHeight;
1968 int NestSize = a_NestSize + (nestRnd % (std::max(a_NestSize, 4) / 4));
1970 while (Num < NestSize)
1974 int xsize = rnd % 2;
1975 int ysize = (rnd / 4) % 2;
1976 int zsize = (rnd / 16) % 2;
1978 for (
int x = xsize; x >= 0; --x)
1980 int BlockX = BaseX + x;
1986 for (
int y = ysize; y >= 0; --y)
1988 int BlockY = BaseY + y;
1994 for (
int z = zsize; z >= 0; --z)
1996 int BlockZ = BaseZ + z;
2004 const auto blockType = blockTypes[Index];
2007 blockTypes[Index] = a_OreType;
2008 blockMetas[Index] = a_OreMeta;
2018 case 0: BaseX--;
break;
2019 case 1: BaseX++;
break;
2021 switch ((rnd >> 3) % 4)
2023 case 0: BaseY--;
break;
2024 case 1: BaseY++;
break;
2026 switch ((rnd >> 6) % 4)
2028 case 0: BaseZ--;
break;
2029 case 1: BaseZ++;
break;
2045 auto valueName = a_GenName +
"Blocks";
2046 auto pocketCfg = a_IniFile.
GetValue(
"Generator", valueName,
"");
2047 if (pocketCfg.empty())
2058 valueName = a_GenName +
"Seed";
2069 int a_MaxHeight,
int a_NumNests,
int a_NestSize,
2079 imprintChunkOrePockets(chunkX - 1, chunkZ - 1, a_ChunkDesc, a_OreType, a_OreMeta, a_MaxHeight, a_NumNests, a_NestSize, a_Seq);
2080 imprintChunkOrePockets(chunkX - 1, chunkZ, a_ChunkDesc, a_OreType, a_OreMeta, a_MaxHeight, a_NumNests, a_NestSize, a_Seq);
2081 imprintChunkOrePockets(chunkX, chunkZ - 1, a_ChunkDesc, a_OreType, a_OreMeta, a_MaxHeight, a_NumNests, a_NestSize, a_Seq);
2082 imprintChunkOrePockets(chunkX, chunkZ, a_ChunkDesc, a_OreType, a_OreMeta, a_MaxHeight, a_NumNests, a_NestSize, a_Seq);
2090 int a_ChunkX,
int a_ChunkZ,
2093 int a_MaxHeight,
int a_NumNests,
int a_NestSize,
2100 for (
int i = 0; i < a_NumNests; i++)
2107 int baseY = nestRnd % a_MaxHeight;
2108 nestRnd /= a_MaxHeight;
2111 baseX, baseY, baseZ,
2112 a_NestSize, i + 200 * a_Seq,
2113 a_OreType, a_OreMeta
2124 int a_MinPocketX,
int a_PocketY,
int a_MinPocketZ,
2125 int a_NestSize,
int a_Seq,
2132 double x1 =
static_cast<double>(a_MinPocketX) + 0.5;
2133 double y1 =
static_cast<double>(a_PocketY) + 0.5;
2134 double z1 =
static_cast<double>(a_MinPocketZ) + 0.5;
2136 double angle =
static_cast<double>(rnd % 256) / (256.0 * M_PI / 2.0);
2138 double length =
static_cast<double>(a_NestSize) / 4.0;
2139 double x2 = x1 + sin(angle) * length;
2140 double z2 = z1 + cos(angle) * length;
2141 double y2 = y1 +
static_cast<double>((rnd % 3) - 1);
2144 double stepX = (x2 - x1) /
static_cast<double>(a_NestSize);
2145 double stepY = (y2 - y1) /
static_cast<double>(a_NestSize);
2146 double stepZ = (z2 - z1) /
static_cast<double>(a_NestSize);
2147 double stepR = M_PI /
static_cast<double>(a_NestSize);
2148 double size =
static_cast<double>(a_NestSize) / 16.0;
2149 for (
int i = 0; i < a_NestSize; ++i)
2151 double iDbl =
static_cast<double>(i);
2152 double sphereX = x1 + stepX * iDbl;
2153 double sphereY = y1 + stepY * iDbl;
2154 double sphereZ = z1 + stepZ * iDbl;
2155 double radius = (sin(stepR * iDbl) + 1.0) * size + 1.0;
2156 imprintSphere(a_ChunkDesc, sphereX, sphereY, sphereZ, radius, a_OreType, a_OreMeta);
2166 double a_SphereX,
double a_SphereY,
double a_SphereZ,
double a_Radius,
2173 int minX = std::max(
FloorC(a_SphereX - a_Radius), baseX);
2174 int minY = std::max(
FloorC(a_SphereY - a_Radius), 0);
2175 int minZ = std::max(
FloorC(a_SphereZ - a_Radius), baseZ);
2198 double radiusSq = a_Radius * a_Radius / 4.0;
2199 for (
int y = minY; y <= maxY; y++)
2201 double relY =
static_cast<double>(y) + 0.5 - a_SphereY;
2202 double relYSq = relY * relY;
2203 if (relYSq > radiusSq)
2208 for (
int z = minZ; z <= maxZ; z++)
2210 double relZ =
static_cast<double>(z) + 0.5 - a_SphereZ;
2211 double relZSq = relZ * relZ;
2212 if (relZSq + relYSq > radiusSq)
2217 for (
int x = minX; x <= maxX; x++)
2219 double relX =
static_cast<double>(x) + 0.5 - a_SphereX;
2220 double relXSq = relX * relX;
2221 if (relZSq + relYSq + relXSq > radiusSq)
2260 auto Biome = a_ChunkDesc.
GetBiome(Pos.x, Pos.z);
2267 const int TwoLimit = 70;
2268 const int ThreeLimit = 90;
2272 if (RadiusChance > TwoLimit && RadiusChance <= ThreeLimit)
2276 else if (RadiusChance > ThreeLimit)
2284 auto StartBlock = a_ChunkDesc.
GetBlockType(Pos.x, Pos.y, Pos.z);
2292 StartBlock = a_ChunkDesc.
GetBlockType(Pos.x, Pos.y, Pos.z);
2296 Pos.y -= Radius - 1;
2299 for (
int x = -Radius; x <= Radius; x++)
2301 for (
int y = -Radius; y <= Radius; y++)
2303 for (
int z = -Radius; z <= Radius; z++)
2310 if (
Vector3d(x, y, z).SqrLength() > Radius * Radius + 1)
int GetSnowStartHeight(EMCSBiome a_Biome)
Returns the height when a biome when a biome starts snowing.
bool IsBiomeVeryCold(EMCSBiome a_Biome)
Returns true if the biome is very cold (has snow on ground everywhere, turns top water to ice,...
bool IsBiomeMountain(EMCSBiome a_Biome)
Returns true if the biome is mountainous (mutations of the extreme hills biome)
EMCSBiome StringToBiome(const AString &a_BiomeString)
Translates a biome string to biome enum.
bool IsBiomeMesa(EMCSBiome a_Biome)
Returns true if the biome is Mesa or one of its mutations.
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
bool IsBlockWater(BLOCKTYPE a_BlockType)
int BlockStringToType(const AString &a_BlockTypeString)
Translates a blocktype string into blocktype.
bool StringToItem(const AString &a_ItemTypeString, cItem &a_Item)
Translates an itemtype string into an item.
AString ItemTypeToString(short a_ItemType)
Translates itemtype into a string.
@ E_META_TALL_GRASS_GRASS
@ E_META_BIG_FLOWER_DOUBLE_TALL_GRASS
@ E_META_BIG_FLOWER_LARGE_FERN
@ E_BLOCK_STATIONARY_LAVA
@ E_BLOCK_MOSSY_COBBLESTONE
@ E_BLOCK_NETHER_QUARTZ_ORE
@ E_BLOCK_STATIONARY_WATER
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char HEIGHTTYPE
The type used by the heightmap.
unsigned char BLOCKTYPE
The datatype used by blockdata.
bool IsValidBlock(int a_BlockType)
Returns true if the specified block type is valid (known).
eDimension
Dimension of a world.
static bool IsWater(BLOCKTYPE a_BlockType)
#define DEF_END_LAVA_SPRINGS
#define DEF_NETHER_LAVA_SPRINGS
#define DEF_OVERWORLD_LAVA_SPRINGS
#define DEF_OVERWORLD_WATER_SPRINGS
#define DEF_ANIMAL_SPAWN_PERCENT
#define DEF_NETHER_WATER_SPRINGS
#define DEF_END_WATER_SPRINGS
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
T Clamp(T a_Value, T a_Min, T a_Max)
Clamp X to the specified range.
std::enable_if< std::is_arithmetic< T >::value, C >::type CeilC(T a_Value)
Ceils a value, then casts it to C (an int by default).
std::enable_if< std::is_arithmetic< T >::value, C >::type FloorC(T a_Value)
Floors a value, then casts it to C (an int by default).
void LOGWARNING(std::string_view a_Format, const Args &... args)
eMonsterType
Identifies individual monster type.
float NOISE_DATATYPE
The datatype used by all the noise generators.
AStringVector StringSplitAndTrim(const AString &str, const AString &delim)
Split the string at any of the listed delimiters and trim each value.
std::vector< AString > AStringVector
bool StringToInteger(const AString &a_str, T &a_Num)
Parses any integer type.
Vector3< double > Vector3d
static bool IsSolid(BLOCKTYPE Block)
Is this block solid (player cannot walk through)?
static bool IsSnowable(BLOCKTYPE Block)
static bool FullyOccupiesVoxel(BLOCKTYPE Block)
Does this block fully occupy its voxel - is it a 'full' block?
static bool IsTransparent(BLOCKTYPE Block)
Is a block transparent? (https://minecraft.wiki/w/Opacity)
Constants used throughout the code, useful typedefs and utility functions.
static bool IsValidHeight(Vector3i a_BlockPosition)
Validates a height-coordinate.
BLOCKTYPE BlockTypes[NumBlocks]
The type used for block type operations and storage, AXIS_ORDER ordering.
static bool IsValidWidth(int a_Width)
Validates a width-coordinate.
HEIGHTTYPE HeightMap[Width *Width]
The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the hig...
static BLOCKTYPE GetBlock(const BLOCKTYPE *a_BlockTypes, Vector3i a_RelPos)
static bool IsValidRelPos(Vector3i a_RelPos)
Validates a chunk relative coordinate.
static size_t MakeIndex(int x, int y, int z)
static HEIGHTTYPE GetHeight(const HeightMap &a_HeightMap, int a_X, int a_Z)
static void SetBlock(BLOCKTYPE *a_BlockTypes, int a_X, int a_Y, int a_Z, BLOCKTYPE a_Type)
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
HEIGHTTYPE GetHeight(int a_RelX, int a_RelZ) const
EMCSBiome GetBiome(int a_RelX, int a_RelZ) const
void SetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
cEntityList & GetEntities(void)
void SetHeight(int a_RelX, int a_RelZ, HEIGHTTYPE a_Height)
void SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
cChunkDef::BlockTypes & GetBlockTypes(void)
cChunkDef::HeightMap & GetHeightMap(void)
BlockNibbleBytes & GetBlockMetasUncompressed(void)
NIBBLETYPE GetBlockMeta(int a_RelX, int a_RelY, int a_RelZ) const
BLOCKTYPE GetBlockType(int a_RelX, int a_RelY, int a_RelZ) const
cChunkDef::BiomeMap & GetBiomeMap(void)
HEIGHTTYPE GetMaxHeight(void) const
Returns the maximum height value in the heightmap.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
void TryPlaceClump(cChunkDesc &a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_Block)
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
static std::vector< BiomeInfo > ParseIniFile(cIniFile &a_IniFile, const AString &a_ClumpPrefix)
Parses an inifile in search for all clumps.
const int MIN_NUM_FOLIAGE
The minimum number of foliage per clump.
const int MAX_NUM_FOLIAGE
The maximum number of foliage per clump.
std::vector< BiomeInfo > m_FlowersPerBiome
void TryPlaceFoliageClump(cChunkDesc &a_ChunkDesc, int a_RelX, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_IsDoubleTall)
const int RANGE_FROM_CENTER
The maximum range a foliage can be placed from the center of the clump.
static void ParseConfigurationString(const AString &a_String, std::vector< BiomeInfo > &a_Output)
Parses a string and puts a vector with a length of biMaxVariantBiome in a_Output.
std::vector< FoliageInfo > m_Blocks
int m_MinNumClumpsPerChunk
int m_MaxNumClumpsPerChunk
void TryPlaceGlowstone(cChunkDesc &a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ, int a_Size, int a_NumStrings)
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
static bool CanFernGrow(EMCSBiome a_Biome)
static bool CanGrassGrow(EMCSBiome a_Biome)
static int GetBiomeDensity(EMCSBiome a_Biome)
static bool CanLargeFernGrow(EMCSBiome a_Biome)
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
bool IsJungleVariant(EMCSBiome a_Biome)
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
bool TryAddSugarcane(cChunkDesc &a_ChunkDesc, int a_RelX, HEIGHTTYPE &a_RelY, int a_RelZ)
Tries to place sugarcane at the coords specified, returns true if successful, updates the top variabl...
static bool IsDesertVariant(EMCSBiome a_biome)
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
bool TryAddCactus(cChunkDesc &a_ChunkDesc, int a_RelX, HEIGHTTYPE &a_RelY, int a_RelZ)
Tries to place cactus at the coords specified, returns true if successful, updates the top variable (...
int m_Amount
Relative amount of blocks to try adding.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
bool IsAllowedBlockBelow(BLOCKTYPE a_BlockBelow)
Returns true if the given blocktype may be below m_BlockType.
bool IsAllowedBiome(EMCSBiome a_Biome)
Returns true if the given biome is a biome that is allowed.
int GetNumToGen(const cChunkDef::BiomeMap &a_BiomeMap)
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
cFinishGenPreSimulator(bool a_PreSimulateFallingBlocks, bool a_PreSimulateWater, bool a_PreSimulateLava)
void CollapseSandGravel(cChunkDesc &a_ChunkDesc)
Drops hanging sand and gravel down to the ground, recalculates heightmap.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
void StationarizeFluid(cChunkDef::BlockTypes &a_BlockTypes, cChunkDef::HeightMap &a_HeightMap, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid)
For each fluid block:
bool m_PreSimulateFallingBlocks
bool TryPlaceSpring(cChunkDesc &a_ChunkDesc, int x, int y, int z)
Tries to place a spring at the specified coords, checks neighbors.
cProbabDistrib m_HeightDistribution
cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile &a_IniFile, eDimension a_Dimension)
int m_Chance
Chance, [0..100], that a spring will be generated in a chunk.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
bool TrySpawnAnimals(cChunkDesc &a_ChunkDesc, int x, int y, int z, eMonsterType AnimalToSpawn)
Returns false if an animal cannot spawn at given coords, else adds it to the chunk's entity list and ...
int m_AnimalProbability
Chance, [0..100], that an animal pack will be generated in a chunk.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
eMonsterType GetRandomMob(cChunkDesc &a_ChunkDesc)
Picks a random animal from biome-dependant list for a random position in the chunk.
cFinishGenPassiveMobs(int a_Seed, cIniFile &a_IniFile, eDimension a_Dimension)
cNoise m_Noise
The noise used as the source of randomness.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
static const OreInfos & DefaultOverworldOres(void)
Returns a vector of OreInfo structures describing the default Overworld ores, usable in the construct...
static OreInfos OreInfosFromString(const AString &a_OreInfosString)
Parses the parameter string into OreInfos array.
OreInfos m_OreInfos
All the ores enabled in this generator.
static const OreInfos & DefaultNetherOres(void)
Returns a vector of OreInfo structures describing the default Nether ores, usable in the constructor.
cNoise m_Noise
The noise used for generating.
static AString OreInfosToString(const OreInfos &a_OreInfos)
Returns a string that represents the OreInfos given as the parameter.
static const OreInfos & DefaultNaturalPatches(void)
Returns a vector of OreInfo structures describing the default Overworld non-ore pockets (dirt,...
std::vector< OreInfo > OreInfos
virtual void GenerateOre(cChunkDesc &a_ChunkDesc, BLOCKTYPE a_OreType, NIBBLETYPE a_OreMeta, int a_MaxHeight, int a_NumNests, int a_NestSize, int a_Seq)=0
Generates a single ore in the specified chunk image.
void SetSeed(int a_Seed)
(Re-)sets the seed used by the internal generating mechanisms.
virtual void GenerateOre(cChunkDesc &a_ChunkDesc, BLOCKTYPE a_OreType, NIBBLETYPE a_OreMeta, int a_MaxHeight, int a_NumNests, int a_NestSize, int a_Seq) override
Generates a single ore in the specified chunk image.
virtual void GenerateOre(cChunkDesc &a_ChunkDesc, BLOCKTYPE a_OreType, NIBBLETYPE a_OreMeta, int a_MaxNestHeight, int a_NumNests, int a_NestSize, int a_Seq) override
Generates a single ore in the specified chunk image.
void imprintChunkOrePockets(int a_ChunkX, int a_ChunkZ, cChunkDesc &a_ChunkDesc, BLOCKTYPE a_OreType, NIBBLETYPE a_OreMeta, int a_MaxHeight, int a_NumNests, int a_NestSize, int a_Seq)
Calculates the pockets for the specified chunk and imprints them into the specified ChunkDesc (not ne...
void imprintPocket(cChunkDesc &a_ChunkDesc, int a_MinPocketX, int a_PocketY, int a_MinPocketZ, int a_NestSize, int a_Seq, BLOCKTYPE a_OreType, NIBBLETYPE a_OreMeta)
Imprints a single pocket of the specified ore at the specified coords into the chunk.
void imprintSphere(cChunkDesc &a_ChunkDesc, double a_SphereX, double a_SphereY, double a_SphereZ, double a_Radius, BLOCKTYPE a_OreType, NIBBLETYPE a_OreMeta)
Imprints a single sphere of the specified ore at the specified coords.
void Initialize(cIniFile &a_IniFile, const AString &a_GenName)
Reads the configuration from the specified INI file.
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
cFinishGenForestRocks(int a_Seed, cIniFile &a_IniFile)
int FindKey(const AString &keyname) const
Returns index of specified key, or noID if not found.
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 GetNumValues(const AString &keyname) const
AString GetValueName(const AString &keyname, const int valueID) const
int GetValueI(const AString &keyname, const AString &valuename, const int defValue=0) const
int GetValueSetI(const AString &keyname, const AString &valuename, const int defValue=0) override
bool SetValue(const int keyID, const int valueID, const AString &value)
AString GetValueSet(const AString &keyname, const AString &valuename, const AString &defValue="") override
Gets the value; if not found, write the default to the repository.
static std::unique_ptr< cMonster > NewMonsterFromType(eMonsterType a_MobType)
Creates a new object of the specified mob.
static eFamily FamilyFromType(eMonsterType a_MobType)
Returns the mob family based on the type.
static std::set< eMonsterType > GetAllowedMobTypes(EMCSBiome a_Biome)
Returns all mob types that can spawn that biome.
int IntNoise1DInt(int a_X) const
NOISE_DATATYPE CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) const
NOISE_DATATYPE IntNoise2D(int a_X, int a_Y) const
NOISE_DATATYPE CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOISE_DATATYPE a_Z) const
int IntNoise3DInt(int a_X, int a_Y, int a_Z) const
int IntNoise2DInt(int a_X, int a_Y) const
NOISE_DATATYPE IntNoise3D(int a_X, int a_Y, int a_Z) const
bool SetDefString(const AString &a_DefString)
Sets the distribution curve using a definition string; returns true on successful parse.
int MapValue(int a_OrigValue) const
Maps value in range [0, m_Sum] into the range [0, m_MaxValue] using the stored probability.
static bool DoesBurnForever(BLOCKTYPE a_BlockType)
static bool CanWashAway(BLOCKTYPE a_BlockType)