summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemSlab.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items/ItemSlab.h')
-rw-r--r--src/Items/ItemSlab.h41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/Items/ItemSlab.h b/src/Items/ItemSlab.h
index e0a405fe0..678106a65 100644
--- a/src/Items/ItemSlab.h
+++ b/src/Items/ItemSlab.h
@@ -7,25 +7,32 @@
-class cItemSlabHandler final:
- public cItemHandler
+class cItemSlabHandler final : public cItemHandler
{
using Super = cItemHandler;
-public:
-
+ public:
using Super::Super;
-private:
-
- virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) const override
+ private:
+ virtual bool CommitPlacement(
+ cPlayer & a_Player,
+ const cItem & a_HeldItem,
+ const Vector3i a_PlacePosition,
+ const eBlockFace a_ClickedBlockFace,
+ const Vector3i a_CursorPosition
+ ) const override
{
// Confer BlockSlab.h, which we're in cahoots with to make the below logic work.
// If clicking a slab, combine it into a double-slab:
if (cBlockSlabHandler::IsAnySlabType(a_Player.GetWorld()->GetBlock(a_PlacePosition)))
{
- if (!a_Player.PlaceBlock(a_PlacePosition, GetDoubleSlabType(static_cast<BLOCKTYPE>(a_HeldItem.m_ItemType)), static_cast<NIBBLETYPE>(a_HeldItem.m_ItemDamage)))
+ if (!a_Player.PlaceBlock(
+ a_PlacePosition,
+ GetDoubleSlabType(static_cast<BLOCKTYPE>(a_HeldItem.m_ItemType)),
+ static_cast<NIBBLETYPE>(a_HeldItem.m_ItemDamage)
+ ))
{
return false;
}
@@ -35,7 +42,11 @@ private:
}
// Set the correct metadata based on player equipped item:
- if (!a_Player.PlaceBlock(a_PlacePosition, static_cast<BLOCKTYPE>(a_HeldItem.m_ItemType), FaceToMetaData(static_cast<NIBBLETYPE>(a_HeldItem.m_ItemDamage), a_ClickedBlockFace, a_CursorPosition)))
+ if (!a_Player.PlaceBlock(
+ a_PlacePosition,
+ static_cast<BLOCKTYPE>(a_HeldItem.m_ItemType),
+ FaceToMetaData(static_cast<NIBBLETYPE>(a_HeldItem.m_ItemDamage), a_ClickedBlockFace, a_CursorPosition)
+ ))
{
return false;
}
@@ -50,7 +61,11 @@ private:
}
- static NIBBLETYPE FaceToMetaData(const NIBBLETYPE a_BaseMeta, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition)
+ static NIBBLETYPE FaceToMetaData(
+ const NIBBLETYPE a_BaseMeta,
+ const eBlockFace a_ClickedBlockFace,
+ const Vector3i a_CursorPosition
+ )
{
switch (a_ClickedBlockFace)
{
@@ -90,10 +105,10 @@ private:
{
switch (a_SingleSlabBlockType)
{
- case E_BLOCK_STONE_SLAB: return E_BLOCK_DOUBLE_STONE_SLAB;
- case E_BLOCK_WOODEN_SLAB: return E_BLOCK_DOUBLE_WOODEN_SLAB;
+ case E_BLOCK_STONE_SLAB: return E_BLOCK_DOUBLE_STONE_SLAB;
+ case E_BLOCK_WOODEN_SLAB: return E_BLOCK_DOUBLE_WOODEN_SLAB;
case E_BLOCK_RED_SANDSTONE_SLAB: return E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB;
- case E_BLOCK_PURPUR_SLAB: return E_BLOCK_PURPUR_DOUBLE_SLAB;
+ case E_BLOCK_PURPUR_SLAB: return E_BLOCK_PURPUR_DOUBLE_SLAB;
}
UNREACHABLE("Unhandled slab type");
}