diff options
author | Gargaj <gargaj@conspiracy.hu> | 2015-11-09 21:12:32 +0100 |
---|---|---|
committer | Gargaj <gargaj@conspiracy.hu> | 2015-11-09 21:12:32 +0100 |
commit | b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f (patch) | |
tree | 82ed2cf73863cd74a2dd73a4b0ac9a13f76f4603 | |
parent | Merge pull request #2628 from Gargaj/creeperdeflate (diff) | |
download | cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.tar cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.tar.gz cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.tar.bz2 cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.tar.lz cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.tar.xz cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.tar.zst cuberite-b5de4a9a6f4a1de3a5e8e2ba95fffa5f1b40fb4f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Items/ItemSlab.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/Items/ItemSlab.h b/src/Items/ItemSlab.h index 21b53081a..97f721c2f 100644 --- a/src/Items/ItemSlab.h +++ b/src/Items/ItemSlab.h @@ -60,7 +60,15 @@ public: ) { a_World.BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch); - return a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, m_DoubleSlabBlockType, ClickedBlockMeta & 0x07); + if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, m_DoubleSlabBlockType, ClickedBlockMeta & 0x07)) + { + return false; + } + if (a_Player.IsGameModeSurvival()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + return true; } // If clicking the bottom side of a top-half slab, combine into a doubleslab: @@ -70,7 +78,15 @@ public: ) { a_World.BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch); - return a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, m_DoubleSlabBlockType, ClickedBlockMeta & 0x07); + if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, m_DoubleSlabBlockType, ClickedBlockMeta & 0x07)) + { + return false; + } + if (a_Player.IsGameModeSurvival()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + return true; } } @@ -86,7 +102,15 @@ public: ) { a_World.BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch); - return a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, m_DoubleSlabBlockType, PlaceBlockMeta & 0x07); + if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, m_DoubleSlabBlockType, PlaceBlockMeta & 0x07)) + { + return false; + } + if (a_Player.IsGameModeSurvival()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + return true; } // The slabs didn't combine, use the default handler to place the slab: |