diff options
author | worktycho <work.tycho@gmail.com> | 2015-11-09 22:37:40 +0100 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-11-09 22:37:40 +0100 |
commit | 0a1751d2d84ee0ead9c35afc2f6641fbee217edb (patch) | |
tree | 82ed2cf73863cd74a2dd73a4b0ac9a13f76f4603 /src/Items/ItemSlab.h | |
parent | Merge pull request #2628 from Gargaj/creeperdeflate (diff) | |
parent | remove slab from inventory when using it on another slab (fixes #2610) (diff) | |
download | cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.tar cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.tar.gz cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.tar.bz2 cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.tar.lz cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.tar.xz cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.tar.zst cuberite-0a1751d2d84ee0ead9c35afc2f6641fbee217edb.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: |