summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockStairs.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-05-05 15:25:10 +0200
committerGitHub <noreply@github.com>2021-05-05 15:25:10 +0200
commita62b2b1be2103d7de2fd66c7304b7473e369be3c (patch)
treea44f2b43fd90f5c79af5e308b554349e6dc546af /src/Blocks/BlockStairs.h
parentRename files to match code (diff)
downloadcuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.gz
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.bz2
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.lz
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.xz
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.zst
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.zip
Diffstat (limited to 'src/Blocks/BlockStairs.h')
-rw-r--r--src/Blocks/BlockStairs.h72
1 files changed, 2 insertions, 70 deletions
diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h
index 701ad38e1..55a9e877e 100644
--- a/src/Blocks/BlockStairs.h
+++ b/src/Blocks/BlockStairs.h
@@ -8,9 +8,9 @@
class cBlockStairsHandler final :
- public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true>>
+ public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true>>
{
- using Super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true>>;
+ using Super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true>>;
public:
@@ -18,74 +18,6 @@ public:
private:
- virtual bool GetPlacementBlockTypeMeta(
- cChunkInterface & a_ChunkInterface,
- cPlayer & a_Player,
- const Vector3i a_PlacedBlockPos,
- eBlockFace a_ClickedBlockFace,
- const Vector3i a_CursorPos,
- BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
- ) const override
- {
- UNUSED(a_ChunkInterface);
- UNUSED(a_PlacedBlockPos);
- UNUSED(a_CursorPos);
- a_BlockType = m_BlockType;
- a_BlockMeta = RotationToMetaData(a_Player.GetYaw());
- switch (a_ClickedBlockFace)
- {
- case BLOCK_FACE_TOP: break;
- case BLOCK_FACE_BOTTOM: a_BlockMeta = a_BlockMeta | 0x4; break; // When placing onto a bottom face, always place an upside-down stairs block
- case BLOCK_FACE_EAST:
- case BLOCK_FACE_NORTH:
- case BLOCK_FACE_SOUTH:
- case BLOCK_FACE_WEST:
- {
- // When placing onto a sideways face, check cursor, if in top half, make it an upside-down stairs block
- if (a_CursorPos.y > 8)
- {
- a_BlockMeta |= 0x4;
- }
- break;
- }
- case BLOCK_FACE_NONE: return false;
- }
- return true;
- }
-
-
-
-
-
- static NIBBLETYPE RotationToMetaData(double a_Rotation)
- {
- a_Rotation += 90 + 45; // So its not aligned with axis
- if (a_Rotation > 360)
- {
- a_Rotation -= 360;
- }
- if ((a_Rotation >= 0) && (a_Rotation < 90))
- {
- return 0x0;
- }
- else if ((a_Rotation >= 180) && (a_Rotation < 270))
- {
- return 0x1;
- }
- else if ((a_Rotation >= 90) && (a_Rotation < 180))
- {
- return 0x2;
- }
- else
- {
- return 0x3;
- }
- }
-
-
-
-
-
virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) const override
{
// Toggle bit 3: