summaryrefslogtreecommitdiffstats
path: root/src/Generating/FinishGen.cpp
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2020-08-09 22:49:40 +0200
committerGitHub <noreply@github.com>2020-08-09 22:49:40 +0200
commitfed03048ad699fb8bc4e216c8ad2ae4d57e5a17f (patch)
treea44291edf9509a237c250a20ce6b521448932186 /src/Generating/FinishGen.cpp
parentFix arrows preventing block placement (diff)
downloadcuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.tar
cuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.tar.gz
cuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.tar.bz2
cuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.tar.lz
cuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.tar.xz
cuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.tar.zst
cuberite-fed03048ad699fb8bc4e216c8ad2ae4d57e5a17f.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/FinishGen.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index 1593c6928..71be3e497 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -1622,6 +1622,7 @@ const cFinishGenOres::OreInfos & cFinishGenOres::DefaultOverworldOres(void)
{E_BLOCK_REDSTONE_ORE, 0, 16, 8, 7},
{E_BLOCK_DIAMOND_ORE, 0, 15, 1, 7},
{E_BLOCK_LAPIS_ORE, 0, 30, 1, 6},
+ {E_BLOCK_EMERALD_ORE, 0, 32, 11, 1},
};
return res;
}
@@ -1750,6 +1751,24 @@ void cFinishGenOreNests::GenerateOre(
// It does so by making a random XYZ walk and adding ore along the way in cuboids of different (random) sizes
// Only "terraformable" blocks get replaced with ore, all other blocks stay (so the nest can actually be smaller than specified).
+ // If there is a try to generate Emerald ores in chunk where there's no mountains biome abort
+ // There are just four points sampled to avoid searching the whole 16 * 16 Blocks
+ if (a_OreType == E_BLOCK_EMERALD_ORE)
+ {
+ auto BiomeSampleOne = a_ChunkDesc.GetBiome( 4, 4);
+ auto BiomeSampleTwo = a_ChunkDesc.GetBiome( 4, 12);
+ auto BiomeSampleThree = a_ChunkDesc.GetBiome(12, 4);
+ auto BiomeSampleFour = a_ChunkDesc.GetBiome(12, 12);
+
+ if (! (IsBiomeMountain(BiomeSampleOne) ||
+ (IsBiomeMountain(BiomeSampleTwo)) ||
+ (IsBiomeMountain(BiomeSampleThree)) ||
+ (IsBiomeMountain(BiomeSampleFour))))
+ {
+ return;
+ }
+ }
+
auto chunkX = a_ChunkDesc.GetChunkX();
auto chunkZ = a_ChunkDesc.GetChunkZ();
auto & blockTypes = a_ChunkDesc.GetBlockTypes();
@@ -1763,7 +1782,16 @@ void cFinishGenOreNests::GenerateOre(
nestRnd /= cChunkDef::Width;
int BaseY = nestRnd % a_MaxHeight;
nestRnd /= a_MaxHeight;
- int NestSize = a_NestSize + (nestRnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger
+ // if the NestSize is smaller then four this breaks
+ int NestSize;
+ if (a_NestSize >= 4)
+ {
+ NestSize = a_NestSize + (nestRnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger
+ }
+ else
+ {
+ NestSize = a_NestSize;
+ }
int Num = 0;
while (Num < NestSize)
{