diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-04 21:22:14 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-04 21:22:14 +0200 |
commit | 3ee523628465a59070354781cda6585f6778192c (patch) | |
tree | 0ef22389cfc7738fd79a02b11e1bc33a63f28b09 /source/Blocks/BlockLadder.h | |
parent | Expat project: fixed intermediate files output folder (diff) | |
download | cuberite-3ee523628465a59070354781cda6585f6778192c.tar cuberite-3ee523628465a59070354781cda6585f6778192c.tar.gz cuberite-3ee523628465a59070354781cda6585f6778192c.tar.bz2 cuberite-3ee523628465a59070354781cda6585f6778192c.tar.lz cuberite-3ee523628465a59070354781cda6585f6778192c.tar.xz cuberite-3ee523628465a59070354781cda6585f6778192c.tar.zst cuberite-3ee523628465a59070354781cda6585f6778192c.zip |
Diffstat (limited to 'source/Blocks/BlockLadder.h')
-rw-r--r-- | source/Blocks/BlockLadder.h | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/source/Blocks/BlockLadder.h b/source/Blocks/BlockLadder.h index 280f0deb1..93473f757 100644 --- a/source/Blocks/BlockLadder.h +++ b/source/Blocks/BlockLadder.h @@ -3,7 +3,6 @@ #include "BlockHandler.h"
#include "../World.h"
-#include "../Ladder.h"
@@ -37,11 +36,37 @@ public: }
a_BlockType = m_BlockType;
- a_BlockMeta = cLadder::DirectionToMetaData(a_BlockFace);
+ a_BlockMeta = DirectionToMetaData(a_BlockFace);
return true;
}
+ static NIBBLETYPE DirectionToMetaData(char a_Direction) // tolua_export
+ { // tolua_export
+ switch (a_Direction)
+ {
+ case 0x2: return 0x2;
+ case 0x3: return 0x3;
+ case 0x4: return 0x4;
+ case 0x5: return 0x5;
+ default: return 0x2;
+ }
+ } // tolua_export
+
+
+ static char MetaDataToDirection(NIBBLETYPE a_MetaData) // tolua_export
+ { // tolua_export
+ switch (a_MetaData)
+ {
+ case 0x2: return 0x2;
+ case 0x3: return 0x3;
+ case 0x4: return 0x4;
+ case 0x5: return 0x5;
+ default: return 0x2;
+ }
+ } // tolua_export
+
+
/// Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure
static char FindSuitableBlockFace(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
@@ -71,8 +96,8 @@ public: virtual bool CanBeAt(int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
- // TODO: Use cTorch::AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison
- char BlockFace = cLadder::MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
+ // TODO: Use AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison
+ char BlockFace = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
return LadderCanBePlacedAt(a_Chunk.GetWorld(), BlockX, a_RelY, BlockZ, BlockFace);
|