diff options
-rw-r--r-- | src/Blocks/BlockBigFlower.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 8ff07fdcd..b25d65258 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -26,26 +26,35 @@ public: virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + int AlternateY = a_BlockY; + if (Meta & 0x8) { - super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ, a_CanDrop); + --AlternateY; } else { + ++AlternateY; + } + // also destroy the other block if it has a valid height and is a big flower + if (cChunkDef::IsValidHeight(AlternateY) && a_ChunkInterface.GetBlock(a_BlockX, AlternateY, a_BlockZ) == E_BLOCK_BIG_FLOWER) + { super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_CanDrop); + a_ChunkInterface.FastSetBlock(a_BlockX, AlternateY, a_BlockZ, E_BLOCK_AIR, 0); } } virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { NIBBLETYPE Meta = a_BlockMeta & 0x7; - - if ((Meta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) || (Meta == E_META_BIG_FLOWER_LARGE_FERN)) + if (Meta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) { - return; + a_Pickups.push_back(cItem(E_ITEM_SEEDS)); + } + else if (Meta != E_META_BIG_FLOWER_LARGE_FERN) + { + a_Pickups.push_back(cItem(E_BLOCK_BIG_FLOWER, 1, Meta)); } - - a_Pickups.push_back(cItem(E_BLOCK_BIG_FLOWER, 1, Meta)); } virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override |