diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-20 19:22:41 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-20 19:22:41 +0200 |
commit | 76b79b51adfd8e71312cf777595483bb1ec68910 (patch) | |
tree | 0ecc7201cad6e719a0252e8da04c5956c9d1513b /src/Generating/FinishGen.cpp | |
parent | Fixed warnings (diff) | |
download | cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.gz cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.bz2 cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.lz cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.xz cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.zst cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.zip |
Diffstat (limited to 'src/Generating/FinishGen.cpp')
-rw-r--r-- | src/Generating/FinishGen.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 86f5711a7..3ee657e38 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -162,24 +162,42 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cFinishGenFoliage: -void cFinishGenFoliage::GenFinish(cChunkDesc & a_ChunkDesc) +void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc) { - for (int x = 1; x < cChunkDef::Width; x++) + for (int x = 0; x < cChunkDef::Width; x++) { - int xx = x + a_ChunkDesc.GetChunkX(); - for (int z = 1; z < cChunkDef::Width; z++) + float xx = (float) x + a_ChunkDesc.GetChunkX(); + for (int z = 0; z < cChunkDef::Width; z++) { - int zz = z + a_ChunkDesc.GetChunkZ(); - if (m_Noise.CubicNoise2D((float) xx + m_Noise.CubicNoise1D(xx), (float) zz + m_Noise.CubicNoise1D(zz)) < GetBiomeDensity(a_ChunkDesc.GetBiome(x, z))) + float zz = (float) z + a_ChunkDesc.GetChunkZ(); + float BiomeDensity = GetBiomeDensity(a_ChunkDesc.GetBiome(x, z)); + if (m_Noise.CubicNoise2D(xx + m_Noise.CubicNoise1D(xx), zz + m_Noise.CubicNoise1D(zz)) < BiomeDensity) { for (int y = a_ChunkDesc.GetHeight(x, z) + 1; y >= 1; y--) { if ( (a_ChunkDesc.GetBlockType(x, y, z) == E_BLOCK_AIR) && - (a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_GRASS) + ((a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_GRASS) || (a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_DIRT)) ) { - a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, m_Noise.CubicNoise2D(xx * 100, zz * 100) > -0.2 ? 1 : 2); + float GrassType = m_Noise.CubicNoise2D(xx * 50, zz * 50); + if (GrassType < 0.2f) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 1); + } + else if (GrassType < 0.8f) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 2); + } + else + { + if (a_ChunkDesc.GetBlockType(x, y + 1, z) == E_BLOCK_AIR) + { + NIBBLETYPE Meta = m_Noise.CubicNoise2D(xx * 100, zz * 100) > -0.5f ? 2 : 3; + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_BIG_FLOWER, Meta); + a_ChunkDesc.SetBlockTypeMeta(x, y + 1, z, E_BLOCK_BIG_FLOWER, 8); + } + } } } } |