From 36dea62662c6b1f6e72f7a1e1fb16a34157fffe4 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Wed, 22 Mar 2017 11:04:32 +0100 Subject: Replace double grass and large fern with placed block --- src/Blocks/BlockBigFlower.h | 24 +++++++++++++++++++++++- src/Blocks/BlockDeadBush.h | 5 +++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 64b2f0714..fe7f47b71 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -18,6 +18,11 @@ public: { } + virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) override + { + return (((a_Meta & E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) != 0) || (a_Meta & E_META_BIG_FLOWER_LARGE_FERN) != 0); + } + 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); @@ -54,7 +59,13 @@ public: NIBBLETYPE FlowerMeta = Meta & 0x7; if (!a_Player->IsGameModeCreative()) { - if (((FlowerMeta == 2) || (FlowerMeta == 3)) && (a_Player->GetEquippedItem().m_ItemType == E_ITEM_SHEARS)) + if ( + (a_Player->GetEquippedItem().m_ItemType == E_ITEM_SHEARS) && + ( + (FlowerMeta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) || + (FlowerMeta == E_META_BIG_FLOWER_LARGE_FERN) + ) + ) { MTRand r1; if (r1.randInt(10) == 5) @@ -73,6 +84,17 @@ public: a_Player->UseEquippedItem(); } } + + if ( + (a_Player->GetEquippedItem().m_ItemType != E_ITEM_SHEARS) && + ( + (FlowerMeta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) || + (FlowerMeta == E_META_BIG_FLOWER_LARGE_FERN) + ) + ) + { + a_ChunkInterface.SetBlock(a_BlockX, a_BlockY, a_BlockZ, 0, 0); + } } bool IsMetaTopPart(NIBBLETYPE a_Meta) diff --git a/src/Blocks/BlockDeadBush.h b/src/Blocks/BlockDeadBush.h index 9afa2d323..0e81d6c2f 100644 --- a/src/Blocks/BlockDeadBush.h +++ b/src/Blocks/BlockDeadBush.h @@ -17,6 +17,11 @@ public: { } + virtual bool DoesIgnoreBuildCollision(void) override + { + return true; + } + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { if (a_RelY <= 0) -- cgit v1.2.3