diff options
author | Mat <mail@mathias.is> | 2019-12-30 00:54:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-30 00:54:37 +0100 |
commit | 5074527d2c5beb9a022f58468071434fbf7fb694 (patch) | |
tree | 9dfee4e7f6c68e573b15817b3265fa9f19e70441 | |
parent | CMake: Fix builds in folders with spaces (diff) | |
download | cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.tar cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.tar.gz cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.tar.bz2 cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.tar.lz cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.tar.xz cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.tar.zst cuberite-5074527d2c5beb9a022f58468071434fbf7fb694.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 4 | ||||
-rw-r--r-- | src/Items/ItemBucket.h | 12 | ||||
-rw-r--r-- | src/Items/ItemDye.h | 6 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 16f323cc3..b2e8c893f 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1452,8 +1452,8 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta); cBlockHandler * BlockHandler = cBlockInfo::GetHandler(BlockType); - bool Placeable = ItemHandler->IsPlaceable() && !m_Player->IsGameModeSpectator(); - bool BlockUsable = BlockHandler->IsUseable() && (!m_Player->IsGameModeSpectator() || cBlockInfo::IsUseableBySpectator(BlockType)); + bool Placeable = ItemHandler->IsPlaceable() && !m_Player->IsGameModeAdventure() && !m_Player->IsGameModeSpectator(); + bool BlockUsable = BlockHandler->IsUseable() && !m_Player->IsGameModeAdventure() && (!m_Player->IsGameModeSpectator() || cBlockInfo::IsUseableBySpectator(BlockType)); if (BlockUsable && !(m_Player->IsCrouched() && !HeldItem.IsEmpty())) { diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index 36caf667b..487b66c8f 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -46,6 +46,12 @@ public: bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) { + // Players can't pick up fluid while in adventure mode. + if (a_Player->IsGameModeAdventure()) + { + return false; + } + if (a_BlockFace != BLOCK_FACE_NONE) { return false; @@ -121,6 +127,12 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock ) { + // Players can't place fluid while in adventure mode. + if (a_Player->IsGameModeAdventure()) + { + return false; + } + if (a_BlockFace != BLOCK_FACE_NONE) { return false; diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h index 94ee9ed6f..7a119437e 100644 --- a/src/Items/ItemDye.h +++ b/src/Items/ItemDye.h @@ -44,6 +44,12 @@ public: } else if ((a_Item.m_ItemDamage == E_META_DYE_BROWN) && (a_BlockFace >= BLOCK_FACE_ZM) && (a_BlockFace <= BLOCK_FACE_XP)) { + // Players can't place blocks while in adventure mode. + if (a_Player->IsGameModeAdventure()) + { + return false; + } + // Cocoa (brown dye) can be planted on jungle logs: BLOCKTYPE BlockType; NIBBLETYPE BlockMeta; |