From f1192c6860fc209509a414beaa4bbeaf87cfcb8d Mon Sep 17 00:00:00 2001 From: QUSpilPrgm Date: Sun, 29 May 2016 22:10:35 +0200 Subject: Makes tall grass and large flowers bonemealable Adds the bonemeal particle effect to some more places --- src/Chunk.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/Chunk.cpp') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index c65c043da..06d5eb319 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -1105,6 +1105,37 @@ int cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) +bool cChunk::GrowTallGrass(int a_RelX, int a_RelY, int a_RelZ) +{ + if (a_RelY > (cChunkDef::Height - 2)) + { + return false; + } + BLOCKTYPE BlockType; + NIBBLETYPE BlockMeta; + if (!UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ, BlockType, BlockMeta)) + { + return false; + } + if (BlockType != E_BLOCK_TALL_GRASS) + { + return false; + } + 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 false; + } + return UnboundedRelFastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_BIG_FLOWER, LargeFlowerMeta) && + UnboundedRelFastSetBlock(a_RelX, a_RelY + 1, a_RelZ, E_BLOCK_BIG_FLOWER, 8); +} + + + + + bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const { if (!cChunkDef::IsValidHeight(a_RelY)) -- cgit v1.2.3