From 0f8c24e04d60aa1642a5fe7346941ccd7697977e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 17 Jul 2014 22:26:53 +0100 Subject: Fixed issues relating to saplings and leaves - Removed cBlockInfo::RequiresSpecialTool * Fixes #1195 * Fixes #1201 --- src/Blocks/BlockLeaves.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockLeaves.h') diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 495e849fa..67c4535b8 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -43,11 +43,17 @@ public: // Only the first 2 bits contain the display information, the others are for growing if (rand.NextInt(6) == 0) { - a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 3)); + a_Pickups.push_back( + cItem( + E_BLOCK_SAPLING, + 1, + (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01)) // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand + ) + ); } // 1 % chance of dropping an apple, if the leaves' type is Apple Leaves - if ((a_BlockMeta & 3) == E_META_LEAVES_APPLE) + if ((m_BlockType == E_BLOCK_LEAVES) && ((a_BlockMeta & 0x03) == E_META_LEAVES_APPLE)) { if (rand.NextInt(101) == 0) { -- cgit v1.2.3 From dfadcf745384f574e751e78bc3e2ddb262fe1fdf Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 23 Jul 2014 09:11:42 +0200 Subject: BlockLeaves: Fixed comment style. --- src/Blocks/BlockLeaves.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockLeaves.h') diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 1635eba08..e426c89e0 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -40,14 +40,14 @@ public: { cFastRandom rand; - // Only the first 2 bits contain the display information, the others are for growing + // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand if (rand.NextInt(6) == 0) { a_Pickups.push_back( cItem( E_BLOCK_SAPLING, 1, - (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01)) // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand + (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01)) ) ); } -- cgit v1.2.3 From 396739cc0faf01a099acbe669c5a9def98d3aaae Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 23 Jul 2014 16:32:09 +0200 Subject: Fix item durability. Fixes #1181 --- src/Blocks/BlockLeaves.h | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'src/Blocks/BlockLeaves.h') diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 797824506..18f336225 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -55,22 +55,6 @@ public: } } } - - - void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override - { - cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ); - - // 0.5% chance of dropping an apple, if the leaves' type is Apple Leaves: - NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - cFastRandom rand; - if (((Meta & 3) == E_META_LEAVES_APPLE) && (rand.NextInt(201) == 100)) - { - cItems Drops; - Drops.push_back(cItem(E_ITEM_RED_APPLE, 1, 0)); - a_WorldInterface.SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ); - } - } virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override -- cgit v1.2.3