summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockRail.h
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-07 21:03:21 +0100
committerGitHub <noreply@github.com>2024-11-07 21:03:21 +0100
commitab62fc398818d717b54110b13e1b3af48e07b686 (patch)
treed76804f9c594695ac3b90a00687b5398158df1f5 /src/Blocks/BlockRail.h
parentAdded code to export definitions for a lua-language-server (#5475) (diff)
downloadcuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.gz
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.bz2
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.lz
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.xz
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.tar.zst
cuberite-ab62fc398818d717b54110b13e1b3af48e07b686.zip
Diffstat (limited to 'src/Blocks/BlockRail.h')
-rw-r--r--src/Blocks/BlockRail.h28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index 4e2e6211f..dea84296f 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -1,10 +1,9 @@
#pragma once
#include "BlockHandler.h"
-#include "BlockSlab.h"
-#include "BlockStairs.h"
#include "BlockType.h"
-#include "Blocks/Mixins.h"
+#include "Mixins/Mixins.h"
+#include "Mixins/SolidSurfaceUnderneath.h"
#include "../BlockInfo.h"
#include "../Chunk.h"
#include "ChunkDef.h"
@@ -25,9 +24,9 @@ enum ENUM_PURE
class cBlockRailHandler final :
- public cClearMetaOnDrop<cBlockHandler>
+ public cSolidSurfaceUnderneath<cClearMetaOnDrop<cBlockHandler>>
{
- using Super = cClearMetaOnDrop<cBlockHandler>;
+ using Super = cSolidSurfaceUnderneath<cClearMetaOnDrop<cBlockHandler>>;
public:
@@ -162,26 +161,9 @@ public:
private:
- static bool CanBeSupportedBy(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
- {
- if (cBlockSlabHandler::IsAnySlabType(a_BlockType))
- {
- return (a_BlockMeta & E_META_WOODEN_SLAB_UPSIDE_DOWN);
- }
- else if (cBlockStairsHandler::IsAnyStairType(a_BlockType))
- {
- return (a_BlockMeta & E_BLOCK_STAIRS_UPSIDE_DOWN);
- }
- return cBlockInfo::FullyOccupiesVoxel(a_BlockType);
- }
-
virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, NIBBLETYPE a_Meta) const override
{
- BLOCKTYPE BelowBlock;
- NIBBLETYPE BelowBlockMeta;
- a_Chunk.GetBlockTypeMeta(a_Position.addedY(-1), BelowBlock, BelowBlockMeta);
-
- if ((a_Position.y <= 0) || !CanBeSupportedBy(BelowBlock, BelowBlockMeta))
+ if (!Super::CanBeAt(a_Chunk, a_Position, a_Meta))
{
return false;
}