diff options
Diffstat (limited to 'src/Blocks/BlockTallGrass.h')
-rw-r--r-- | src/Blocks/BlockTallGrass.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Blocks/BlockTallGrass.h b/src/Blocks/BlockTallGrass.h index c4b7194b5..f02c20523 100644 --- a/src/Blocks/BlockTallGrass.h +++ b/src/Blocks/BlockTallGrass.h @@ -8,6 +8,7 @@ +/** Handles the grass that is 1 block tall */ class cBlockTallGrassHandler: public cBlockHandler { @@ -68,6 +69,30 @@ public: + /** Growing a tall grass produces a big flower (2-block high fern or double-tall grass). */ + virtual int Grow(cChunk & a_Chunk, Vector3i a_RelPos, int a_NumStages = 1) override + { + if (a_RelPos.y > (cChunkDef::Height - 2)) + { + return 0; + } + auto blockMeta = a_Chunk.GetMeta(a_RelPos); + NIBBLETYPE largeFlowerMeta; + switch (blockMeta) + { + case E_META_TALL_GRASS_GRASS: largeFlowerMeta = E_META_BIG_FLOWER_DOUBLE_TALL_GRASS; break; + case E_META_TALL_GRASS_FERN: largeFlowerMeta = E_META_BIG_FLOWER_LARGE_FERN; break; + default: return 0; + } + a_Chunk.SetBlock(a_RelPos, E_BLOCK_BIG_FLOWER, largeFlowerMeta); + a_Chunk.SetBlock(a_RelPos.addedY(1), E_BLOCK_BIG_FLOWER, E_META_BIG_FLOWER_TOP); + return 1; + } + + + + + virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override { UNUSED(a_Meta); |