summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockButton.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/BlockButton.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/BlockButton.h')
-rw-r--r--src/Blocks/BlockButton.h46
1 files changed, 2 insertions, 44 deletions
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index 0c942cb49..896fd58d6 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -101,47 +101,6 @@ 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
- {
- a_BlockType = m_BlockType;
- a_BlockMeta = BlockFaceToMetaData(a_ClickedBlockFace);
- return true;
- }
-
-
-
-
-
- /** Converts the block face of the neighbor to which the button is attached, to the block meta for this button. */
- inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
- {
- switch (a_BlockFace)
- {
- case BLOCK_FACE_YP: return 0x5;
- case BLOCK_FACE_ZM: return 0x4;
- case BLOCK_FACE_ZP: return 0x3;
- case BLOCK_FACE_XM: return 0x2;
- case BLOCK_FACE_XP: return 0x1;
- case BLOCK_FACE_YM: return 0x0;
- case BLOCK_FACE_NONE:
- {
- break;
- }
- }
- UNREACHABLE("Unsupported block face");
- }
-
-
-
-
-
/** Converts the block meta of this button into a block face of the neighbor to which the button is attached. */
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{
@@ -165,10 +124,9 @@ private:
- virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) const override
+ virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
{
- auto Meta = a_Chunk.GetMeta(a_RelPos);
- auto SupportRelPos = AddFaceDirection(a_RelPos, BlockMetaDataToBlockFace(Meta), true);
+ auto SupportRelPos = AddFaceDirection(a_Position, BlockMetaDataToBlockFace(a_Meta), true);
if (!cChunkDef::IsValidHeight(SupportRelPos.y))
{
return false;