summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockLever.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-04-03 22:03:18 +0200
committerHowaner <franzi.moos@googlemail.com>2014-04-03 22:03:18 +0200
commit32d054e8fdad1d486fd4edbb542daa3262220e5f (patch)
tree1094c471768b71e8cac1277c2fbea5a5d9f2caf9 /src/Blocks/BlockLever.h
parentRemove old function (diff)
parentAPIDump: Added angular specifics. (diff)
downloadcuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.gz
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.bz2
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.lz
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.xz
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.zst
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.zip
Diffstat (limited to 'src/Blocks/BlockLever.h')
-rw-r--r--src/Blocks/BlockLever.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h
index 48c7e774b..ad2ae29e5 100644
--- a/src/Blocks/BlockLever.h
+++ b/src/Blocks/BlockLever.h
@@ -1,17 +1,18 @@
#pragma once
#include "BlockHandler.h"
-
+#include "MetaRotator.h"
class cBlockLeverHandler :
- public cBlockHandler
+ public cMetaRotator<cBlockHandler, 0x07, 0x04, 0x02, 0x03, 0x01, false>
{
+ typedef cMetaRotator<cBlockHandler, 0x07, 0x04, 0x02, 0x03, 0x01, false> super;
public:
cBlockLeverHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
+ : cMetaRotator<cBlockHandler, 0x07, 0x04, 0x02, 0x03, 0x01, false>(a_BlockType)
{
}
@@ -102,7 +103,37 @@ public:
AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockMetaDataToBlockFace(Meta), true);
BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn);
- return (a_RelY > 0) && (g_BlockIsSolid[BlockIsOn]);
+ return (a_RelY > 0) && cBlockInfo::IsSolid(BlockIsOn);
+ }
+
+
+ virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
+ {
+ switch (a_Meta)
+ {
+ case 0x00: return 0x07; // Ceiling rotation
+ case 0x07: return 0x00;
+
+ case 0x05: return 0x06; // Ground rotation
+ case 0x06: return 0x05;
+
+ default: return super::MetaRotateCCW(a_Meta); // Wall Rotation
+ }
+ }
+
+
+ virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
+ {
+ switch (a_Meta)
+ {
+ case 0x00: return 0x07; // Ceiling rotation
+ case 0x07: return 0x00;
+
+ case 0x05: return 0x06; // Ground rotation
+ case 0x06: return 0x05;
+
+ default: return super::MetaRotateCCW(a_Meta); // Wall Rotation
+ }
}
} ;