diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-21 16:01:16 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-21 16:01:16 +0200 |
commit | ce956bcdf276daa288c35d702885bba90f6ce283 (patch) | |
tree | 9a55264a9e4be2dbc88029c50d2a47159951db9a /src/Generating/FinishGen.cpp | |
parent | Fixed indentation (diff) | |
download | cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.tar cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.tar.gz cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.tar.bz2 cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.tar.lz cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.tar.xz cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.tar.zst cuberite-ce956bcdf276daa288c35d702885bba90f6ce283.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/FinishGen.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index b332c4f9b..26149f363 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -178,36 +178,36 @@ void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc) continue; } - for (int y = a_ChunkDesc.GetHeight(x, z) + 1; y >= 1; y--) + // Get the top block + 1. This is the place where the grass would finaly be placed. + int y = a_ChunkDesc.GetHeight(x, z) + 1; + + // Check if long grass can be placed. + 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_DIRT)) + ) { - // Check if long grass can be placed. - 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_DIRT)) - ) - { - continue; - } + continue; + } - // Choose what long grass meta we should use. - int GrassType = m_Noise.IntNoise2DInt(xx * 50, zz * 50) / 7 % 100; - if (GrassType < 60) - { - a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 1); - } - else if (GrassType < 90) - { - a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 2); - } - else + // Choose what long grass meta we should use. + int GrassType = m_Noise.IntNoise2DInt(xx * 50, zz * 50) / 7 % 100; + if (GrassType < 60) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 1); + } + else if (GrassType < 90) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 2); + } + else + { + // If double long grass we have to choose what type we should use. + if (a_ChunkDesc.GetBlockType(x, y + 1, z) == E_BLOCK_AIR) { - // If double long grass we have to choose what type we should use. - if (a_ChunkDesc.GetBlockType(x, y + 1, z) == E_BLOCK_AIR) - { - NIBBLETYPE Meta = (m_Noise.IntNoise2DInt(xx * 100, zz * 100) / 7 % 100) > 25 ? 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); - } + NIBBLETYPE Meta = (m_Noise.IntNoise2DInt(xx * 100, zz * 100) / 7 % 100) > 25 ? 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); } } } |