summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockLadder.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockLadder.h41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h
index 29c0cf2b7..90e2d8304 100644
--- a/src/Blocks/BlockLadder.h
+++ b/src/Blocks/BlockLadder.h
@@ -2,7 +2,7 @@
#pragma once
#include "BlockHandler.h"
-#include "ClearMetaOnDrop.h"
+#include "Mixins.h"
@@ -11,13 +11,19 @@
class cBlockLadderHandler :
public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> >
{
- typedef cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> > super;
+ using super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04>>;
+
public:
- cBlockLadderHandler(BLOCKTYPE a_BlockType)
- : super(a_BlockType)
+
+ cBlockLadderHandler(BLOCKTYPE a_BlockType):
+ super(a_BlockType)
{
}
+
+
+
+
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer & a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@@ -40,10 +46,9 @@ public:
return true;
}
- virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
- {
- a_Pickups.Add(m_BlockType, 1, 0); // Reset meta
- }
+
+
+
static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction)
{
@@ -63,6 +68,10 @@ public:
UNREACHABLE("Unsupported block face");
}
+
+
+
+
static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData)
{
switch (a_MetaData)
@@ -75,6 +84,10 @@ public:
}
}
+
+
+
+
/** Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure */
static eBlockFace FindSuitableBlockFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
{
@@ -89,6 +102,10 @@ public:
return BLOCK_FACE_BOTTOM;
}
+
+
+
+
static bool LadderCanBePlacedAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
{
if ((a_BlockFace == BLOCK_FACE_BOTTOM) || (a_BlockFace == BLOCK_FACE_TOP))
@@ -101,6 +118,10 @@ public:
return cBlockInfo::IsSolid(a_ChunkInterface.GetBlock({a_BlockX, a_BlockY, a_BlockZ}));
}
+
+
+
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
// TODO: Use AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison
@@ -110,6 +131,10 @@ public:
return LadderCanBePlacedAt(a_ChunkInterface, BlockX, a_RelY, BlockZ, BlockFace);
}
+
+
+
+
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
{
UNUSED(a_Meta);