summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2022-06-29 01:02:04 +0200
committerGitHub <noreply@github.com>2022-06-29 01:02:04 +0200
commita2b19de07836f7273c66e3cba9922e110bf559e7 (patch)
tree5cadcfe42594181dbfc8d66fc67aaf06d92eab61 /src
parentFix trampling for older clients and mobs (#5414) (diff)
downloadcuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.tar
cuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.tar.gz
cuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.tar.bz2
cuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.tar.lz
cuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.tar.xz
cuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.tar.zst
cuberite-a2b19de07836f7273c66e3cba9922e110bf559e7.zip
Diffstat (limited to 'src')
-rw-r--r--src/Entities/Minecart.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index c8dadbcdd..50be91e4e 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -173,6 +173,17 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
return;
}
+ if (m_bIsOnDetectorRail && !Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT).Equals(m_DetectorRailPosition))
+ {
+ // Check if the rail is still there
+ if (m_World->GetBlock(m_DetectorRailPosition) == E_BLOCK_DETECTOR_RAIL)
+ {
+ m_World->SetBlock(m_DetectorRailPosition, E_BLOCK_DETECTOR_RAIL, m_World->GetBlockMeta(m_DetectorRailPosition) & 0x07);
+ }
+
+ m_bIsOnDetectorRail = false;
+ }
+
BLOCKTYPE InsideType;
NIBBLETYPE InsideMeta;
chunk->GetBlockTypeMeta(relPos, InsideType, InsideMeta);
@@ -198,7 +209,6 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
}
- bool WasDetectorRail = false;
if (IsBlockRail(InsideType))
{
if (InsideType == E_BLOCK_RAIL)
@@ -217,8 +227,9 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
case E_BLOCK_POWERED_RAIL: HandlePoweredRailPhysics(InsideMeta); break;
case E_BLOCK_DETECTOR_RAIL:
{
+ m_DetectorRailPosition = Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT);
+ m_bIsOnDetectorRail = true;
HandleDetectorRailPhysics(InsideMeta, a_Dt);
- WasDetectorRail = true;
break;
}
default: VERIFY(!"Unhandled rail type despite checking if block was rail!"); break;
@@ -233,17 +244,6 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Super::HandlePhysics(a_Dt, *chunk);
}
- if (m_bIsOnDetectorRail && !Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT).Equals(m_DetectorRailPosition))
- {
- m_World->SetBlock(m_DetectorRailPosition, E_BLOCK_DETECTOR_RAIL, m_World->GetBlockMeta(m_DetectorRailPosition) & 0x07);
- m_bIsOnDetectorRail = false;
- }
- else if (WasDetectorRail)
- {
- m_bIsOnDetectorRail = true;
- m_DetectorRailPosition = Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT);
- }
-
// Enforce speed limit:
m_Speed.Clamp(MAX_SPEED_NEGATIVE, MAX_SPEED);