summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockRedstone.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 20:01:53 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 20:01:53 +0200
commit2334c8dd9d6a295e3c445e548b5902c9f49ab532 (patch)
tree914eb4019ea6ca8e1f3c92198b910c05f3a6ecbc /src/Blocks/BlockRedstone.h
parentMigrated cSleep and cTimer to std::chrono (diff)
parentMerge pull request #1554 from SphinxC0re/master (diff)
downloadcuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.gz
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.bz2
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.lz
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.xz
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.zst
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.zip
Diffstat (limited to 'src/Blocks/BlockRedstone.h')
-rw-r--r--src/Blocks/BlockRedstone.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h
index 37d61ed73..2785eb479 100644
--- a/src/Blocks/BlockRedstone.h
+++ b/src/Blocks/BlockRedstone.h
@@ -3,6 +3,7 @@
#include "BlockHandler.h"
#include "../World.h"
+#include "BlockSlab.h"
@@ -16,11 +17,33 @@ public:
: cBlockHandler(a_BlockType)
{
}
-
+
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
- return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)));
+ if (a_RelY <= 0)
+ {
+ return false;
+ }
+
+ BLOCKTYPE BelowBlock;
+ NIBBLETYPE BelowBlockMeta;
+ a_Chunk.GetBlockTypeMeta(a_RelX, a_RelY - 1, a_RelZ, BelowBlock, BelowBlockMeta);
+
+ if (cBlockInfo::FullyOccupiesVoxel(BelowBlock))
+ {
+ return true;
+ }
+ else if (cBlockSlabHandler::IsAnySlabType(BelowBlock))
+ {
+ // Check if the slab is turned up side down
+ if ((BelowBlockMeta & 0x08) == 0x08)
+ {
+ return true;
+ }
+ }
+ return false;
}