diff options
author | Mattes D <github@xoft.cz> | 2014-09-30 22:53:32 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-09-30 22:53:32 +0200 |
commit | 1d185fe2073f4dd68ae9675e9bdbaa554754b8ea (patch) | |
tree | ac0c02f236ecc5904558794dc84c882d9512b0d7 /src/Blocks | |
parent | Merge pull request #1485 from mc-server/PluginMessages (diff) | |
parent | Code improvements (diff) | |
download | cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.gz cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.bz2 cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.lz cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.xz cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.zst cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.zip |
Diffstat (limited to 'src/Blocks')
-rw-r--r-- | src/Blocks/BlockDirt.h | 10 | ||||
-rw-r--r-- | src/Blocks/BlockDoor.h | 18 | ||||
-rw-r--r-- | src/Blocks/BlockTrapdoor.h | 6 |
3 files changed, 32 insertions, 2 deletions
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h index 60d81db72..19f889372 100644 --- a/src/Blocks/BlockDirt.h +++ b/src/Blocks/BlockDirt.h @@ -21,7 +21,15 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); + if (a_BlockMeta == E_META_DIRT_COARSE) + { + // Drop the coarse block (dirt, meta 1) + a_Pickups.Add(E_BLOCK_DIRT, 1, E_META_DIRT_COARSE); + } + else + { + a_Pickups.Add(E_BLOCK_DIRT, 1, E_META_DIRT_NORMAL); + } } diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index 0ff8bcfc8..92ad8da12 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -173,7 +173,23 @@ public: /** Returns true if the specified blocktype is any kind of door */ inline static bool IsDoor(BLOCKTYPE a_Block) { - return (a_Block == E_BLOCK_WOODEN_DOOR) || (a_Block == E_BLOCK_IRON_DOOR); + switch (a_Block) + { + case E_BLOCK_ACACIA_DOOR: + case E_BLOCK_BIRCH_DOOR: + case E_BLOCK_DARK_OAK_DOOR: + case E_BLOCK_IRON_DOOR: + case E_BLOCK_JUNGLE_DOOR: + case E_BLOCK_SPRUCE_DOOR: + case E_BLOCK_WOODEN_DOOR: + { + return true; + } + default: + { + return false; + } + } } diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index 41256ae55..8c96de0f1 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -29,6 +29,12 @@ public: virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { + if (m_BlockType == E_BLOCK_IRON_TRAPDOOR) + { + // Iron doors can only be toggled by redstone, not by right-clicking + return; + } + // Flip the ON bit on/off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); |