summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockWallSign.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-11-30 21:16:21 +0100
committerHowaner <franzi.moos@googlemail.com>2014-11-30 21:16:21 +0100
commit9abc3657832a4e0b52eb5bd2d4ab2baabd321506 (patch)
treef0fcf58615fdc02676ec82d5ba5953f2840dc922 /src/Blocks/BlockWallSign.h
parentAdded a CanBeAt(...) check to HandleRightClick() (diff)
downloadcuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.tar
cuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.tar.gz
cuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.tar.bz2
cuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.tar.lz
cuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.tar.xz
cuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.tar.zst
cuberite-9abc3657832a4e0b52eb5bd2d4ab2baabd321506.zip
Diffstat (limited to 'src/Blocks/BlockWallSign.h')
-rw-r--r--src/Blocks/BlockWallSign.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Blocks/BlockWallSign.h b/src/Blocks/BlockWallSign.h
index 0abe9c52c..9a7d4aa58 100644
--- a/src/Blocks/BlockWallSign.h
+++ b/src/Blocks/BlockWallSign.h
@@ -40,12 +40,18 @@ public:
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
- int BlockX = (a_Chunk.GetPosX() * cChunkDef::Width) + a_RelX;
- int BlockZ = (a_Chunk.GetPosZ() * cChunkDef::Width) + a_RelZ;
- GetBlockCoordsBehindTheSign(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ), BlockX, BlockZ);
- BLOCKTYPE Type = a_ChunkInterface.GetBlock(BlockX, a_RelY, BlockZ);
+ if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType)
+ {
+ return true;
+ }
+
+ NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
+ GetBlockCoordsBehindTheSign(Meta, a_RelX, a_RelZ);
+
+ cChunk * Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ);
+ BLOCKTYPE BehindBlock = Chunk->GetBlock(a_RelX, a_RelY, a_RelZ);
- return ((Type == E_BLOCK_WALLSIGN) || (Type == E_BLOCK_SIGN_POST) || cBlockInfo::IsSolid(Type));
+ return ((BehindBlock == E_BLOCK_WALLSIGN) || (BehindBlock == E_BLOCK_SIGN_POST) || cBlockInfo::IsSolid(BehindBlock));
}