summaryrefslogtreecommitdiffstats
path: root/source/Entities/Minecart.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-13 00:57:02 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-13 00:57:02 +0200
commit22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45 (patch)
treece3313ef732b7e0c6e15d9ee0982432a4fd845f6 /source/Entities/Minecart.cpp
parentFixed water speed issues (diff)
downloadcuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.tar
cuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.tar.gz
cuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.tar.bz2
cuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.tar.lz
cuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.tar.xz
cuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.tar.zst
cuberite-22b8f3a2e0d46b36658fd46fc3e14af85b9dfe45.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/Minecart.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/Entities/Minecart.cpp b/source/Entities/Minecart.cpp
index f633206a2..a2f1e5593 100644
--- a/source/Entities/Minecart.cpp
+++ b/source/Entities/Minecart.cpp
@@ -54,20 +54,24 @@ void cMinecart::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if ((GetPosY() > 0) && (GetPosY() < cChunkDef::Height))
{
BLOCKTYPE BelowType = GetWorld()->GetBlock(floor(GetPosX()), floor(GetPosY() -1 ), floor(GetPosZ()));
+ BLOCKTYPE InsideType = GetWorld()->GetBlock(floor(GetPosX()), floor(GetPosY()), floor(GetPosZ()));
- if (
- (BelowType == E_BLOCK_RAIL) ||
- (BelowType == E_BLOCK_POWERED_RAIL) ||
- (BelowType == E_BLOCK_DETECTOR_RAIL) ||
- (BelowType == E_BLOCK_ACTIVATOR_RAIL)
- )
+ if (IsBlockRail(BelowType))
{
HandleRailPhysics(a_Dt, a_Chunk);
}
else
{
- super::HandlePhysics(a_Dt, a_Chunk);
- BroadcastMovementUpdate();
+ if (IsBlockRail(InsideType))
+ {
+ SetPosY(ceil(GetPosY()));
+ HandleRailPhysics(a_Dt, a_Chunk);
+ }
+ else
+ {
+ super::HandlePhysics(a_Dt, a_Chunk);
+ BroadcastMovementUpdate();
+ }
}
}
else