diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-12-01 16:36:48 +0100 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-12-01 16:36:48 +0100 |
commit | fa4a85c91518575e600fbd5755dda179931d9436 (patch) | |
tree | a7d8a66c6f24af870caff3853920cb0d53eefe17 /src/Generating/FinishGen.cpp | |
parent | Merge pull request #1624 from mc-server/LuaDeprecating (diff) | |
download | cuberite-fa4a85c91518575e600fbd5755dda179931d9436.tar cuberite-fa4a85c91518575e600fbd5755dda179931d9436.tar.gz cuberite-fa4a85c91518575e600fbd5755dda179931d9436.tar.bz2 cuberite-fa4a85c91518575e600fbd5755dda179931d9436.tar.lz cuberite-fa4a85c91518575e600fbd5755dda179931d9436.tar.xz cuberite-fa4a85c91518575e600fbd5755dda179931d9436.tar.zst cuberite-fa4a85c91518575e600fbd5755dda179931d9436.zip |
Diffstat (limited to 'src/Generating/FinishGen.cpp')
-rw-r--r-- | src/Generating/FinishGen.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 1e8a67dd0..898a9b268 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -392,6 +392,88 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc) //////////////////////////////////////////////////////////////////////////////// +// cFinishGenSoulsandRims + +void cFinishGenSoulsandRims::GenFinish(cChunkDesc & a_ChunkDesc) +{ + int ChunkX = a_ChunkDesc.GetChunkX() * cChunkDef::Width; + int ChunkZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width; + HEIGHTTYPE MaxHeight = a_ChunkDesc.GetMaxHeight(); + + for (int x = 0; x < 16; x++) + { + int xx = ChunkX + x; + for (int z = 0; z < 16; z++) + { + int zz = ChunkZ + z; + + // Place soulsand rims when netherrack gets thin + for (int y = 2; y < MaxHeight - 2; y++) + { + // The current block is air. Let's bail ut. + BLOCKTYPE Block = a_ChunkDesc.GetBlockType(x, y, z); + if (Block == E_BLOCK_AIR) + { + continue; + } + + // Check how many blocks there are above the current block. Don't go higher than 2 blocks, because we already bail out if that's the case. + int NumBlocksAbove = 0; + for (int I = y + 1; I <= y + 2; I++) + { + if (a_ChunkDesc.GetBlockType(x, I, z) != E_BLOCK_AIR) + { + NumBlocksAbove++; + } + else + { + break; + } + } + + // There are too many blocks above the current block. + if (NumBlocksAbove == 2) + { + continue; + } + + // Check how many blocks there below the current block. Don't go lower than 2 blocks, because we already bail out if that's the case. + int NumBlocksBelow = 0; + for (int I = y - 1; I >= y - 2; I--) + { + if (a_ChunkDesc.GetBlockType(x, I, z) != E_BLOCK_AIR) + { + NumBlocksBelow++; + } + else + { + break; + } + } + + // There are too many blocks below the current block + if (NumBlocksBelow == 2) + { + continue; + } + + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(xx)) / 32; + NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(zz)) / 32; + NOISE_DATATYPE CompBlock = m_Noise.CubicNoise3D(NoiseX, (float) (y) / 4, NoiseY); + if (CompBlock < 0) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SOULSAND); + } + } + } + } +} + + + + + +//////////////////////////////////////////////////////////////////////////////// // cFinishGenSnow: void cFinishGenSnow::GenFinish(cChunkDesc & a_ChunkDesc) |