summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-13 15:44:20 +0200
committerGitHub <noreply@github.com>2020-09-13 15:44:20 +0200
commitd9d71e1de65e5e46d02190667ee02776a6f641c6 (patch)
treee4c09846e0313e654974892fa98dfac15bbf6026
parentBeds: derestrict clicking block face (#4863) (diff)
downloadcuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.tar
cuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.tar.gz
cuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.tar.bz2
cuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.tar.lz
cuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.tar.xz
cuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.tar.zst
cuberite-d9d71e1de65e5e46d02190667ee02776a6f641c6.zip
-rw-r--r--src/Blocks/BlockRail.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index f5cd7d8a2..16e05351d 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -104,12 +104,14 @@ public:
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) override
{
- auto meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
- auto newMeta = FindMeta(a_ChunkInterface, a_BlockPos);
- if (IsUnstable(a_ChunkInterface, a_BlockPos) && (meta != newMeta))
+ const auto Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
+ const auto NewMeta = FindMeta(a_ChunkInterface, a_BlockPos);
+ if ((Meta != NewMeta) && IsUnstable(a_ChunkInterface, a_BlockPos))
{
- a_ChunkInterface.FastSetBlock(a_BlockPos, m_BlockType, (m_BlockType == E_BLOCK_RAIL) ? newMeta : newMeta | (meta & 0x08));
+ a_ChunkInterface.FastSetBlock(a_BlockPos, m_BlockType, (m_BlockType == E_BLOCK_RAIL) ? NewMeta : NewMeta | (Meta & 0x08));
}
+
+ Super::OnNeighborChanged(a_ChunkInterface, a_BlockPos, a_WhichNeighbor);
}
@@ -285,11 +287,13 @@ public:
return Meta;
}
+
inline bool CanThisRailCurve(void)
{
return m_BlockType == E_BLOCK_RAIL;
}
+
bool IsUnstable(cChunkInterface & a_ChunkInterface, Vector3i a_Pos)
{
if (!IsBlockRail(a_ChunkInterface.GetBlock(a_Pos)))
@@ -422,6 +426,7 @@ public:
return false;
}
+
bool IsNotConnected(cChunkInterface & a_ChunkInterface, Vector3i a_Pos, eBlockFace a_BlockFace, char a_Pure = 0)
{
AddFaceDirection(a_Pos.x, a_Pos.y, a_Pos.z, a_BlockFace, false);
@@ -519,6 +524,7 @@ public:
return true;
}
+
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
{
// Bit 0x08 is a flag when a_Meta is in the range 0x00--0x05 and 0x0A--0x0F.
@@ -556,7 +562,6 @@ public:
}
-
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
{
// Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09.
@@ -593,7 +598,6 @@ public:
}
-
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
{
// MirrorXY basically flips the ZP and ZM parts of the meta
@@ -633,7 +637,6 @@ public:
}
-
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
{
// MirrorYZ basically flips the XP and XM parts of the meta
@@ -673,14 +676,9 @@ public:
}
-
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
{
UNUSED(a_Meta);
return 0;
}
} ;
-
-
-
-