diff options
author | dbhicks <david.bacher.hicks@gmail.com> | 2017-06-14 14:23:33 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-06-14 14:23:33 +0200 |
commit | 8d5f01530d8a08df252e91b078d2410d5a574698 (patch) | |
tree | d8843bf65bb78464caef7e292d864f4a7d2bd920 /src/Blocks/BlockBigFlower.h | |
parent | Added support for protocol 1.12 (#3757) (diff) | |
download | cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.tar cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.tar.gz cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.tar.bz2 cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.tar.lz cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.tar.xz cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.tar.zst cuberite-8d5f01530d8a08df252e91b078d2410d5a574698.zip |
Diffstat (limited to 'src/Blocks/BlockBigFlower.h')
-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 |