From c080f819d2af3cc8c71d39c222a249e4df5e6f67 Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Sun, 11 Oct 2020 17:27:41 +0200 Subject: Adding Silverfish Spawning Blocks (#4946) * added breaking, spawning, animation * checkstyle * added undocumented API symbols * added changes suggested by @peterbell10 * added natural ore like generation * fixed spawning two silverfishes * fixed clang * fixed clang try 2 * updated comment unified offset * final clang fix * added spawning for more silverfishes if one was damaged * fixed spawning on one hit kill * fixed spawning on one hit kill fixed spawning by potion damage * fixed clang * fixed broken build * fixed broken build * I should read the error message properly fixed build now? * added small changes suggested by @peterbell10 Co-authored-by: 12xx12 <12xx12100@gmail.com> --- src/Generating/FinishGen.cpp | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'src/Generating') diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 4077fd98e..78b28bff5 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -1615,14 +1615,15 @@ const cFinishGenOres::OreInfos & cFinishGenOres::DefaultOverworldOres(void) { static OreInfos res { - // OreType, OreMeta, MaxHeight, NumNests, NestSize - {E_BLOCK_COAL_ORE, 0, 127, 20, 16}, - {E_BLOCK_IRON_ORE, 0, 64, 20, 8}, - {E_BLOCK_GOLD_ORE, 0, 32, 2, 8}, - {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}, + // OreType, OreMeta, MaxHeight, NumNests, NestSize + {E_BLOCK_COAL_ORE, 0, 127, 20, 16}, + {E_BLOCK_IRON_ORE, 0, 64, 20, 8}, + {E_BLOCK_GOLD_ORE, 0, 32, 2, 8}, + {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}, + {E_BLOCK_SILVERFISH_EGG, 0, 64, 7, 9}, }; return res; } @@ -1792,6 +1793,24 @@ void cFinishGenOreNests::GenerateOre( } } + if (a_OreType == E_BLOCK_SILVERFISH_EGG) + { + const auto BiomeSampleOne = a_ChunkDesc.GetBiome( 4, 4); + const auto BiomeSampleTwo = a_ChunkDesc.GetBiome( 4, 12); + const auto BiomeSampleThree = a_ChunkDesc.GetBiome(12, 4); + const 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(); -- cgit v1.2.3