summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-04-26 18:21:49 +0200
committerarchshift <admin@archshift.com>2014-04-26 18:25:30 +0200
commitaef2c8ec628aa2522364da1333bc5158e55ac6a2 (patch)
treeda83f950fb33b4910d006499930b98fb231e2fd7 /src/Entities/Minecart.cpp
parentFixed mobs that don't naturally spawn. (diff)
downloadcuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar
cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.gz
cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.bz2
cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.lz
cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.xz
cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.zst
cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.zip
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r--src/Entities/Minecart.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index ceaa713bb..db55eb058 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -234,15 +234,18 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return;
- if (GetSpeedZ() > 0)
- {
- // Going SOUTH, slow down
- AddSpeedZ(-0.1);
- }
- else if (GetSpeedZ() < 0)
+ if (GetSpeedZ() != 0) // Don't do anything if cart is stationary
{
- // Going NORTH, slow down
- AddSpeedZ(0.1);
+ if (GetSpeedZ() > 0)
+ {
+ // Going SOUTH, slow down
+ AddSpeedZ(-0.1);
+ }
+ else
+ {
+ // Going NORTH, slow down
+ AddSpeedZ(0.1);
+ }
}
break;
}
@@ -256,13 +259,16 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return;
- if (GetSpeedX() > 0)
- {
- AddSpeedX(-0.1);
- }
- else if (GetSpeedX() < 0)
+ if (GetSpeedX() != 0)
{
- AddSpeedX(0.1);
+ if (GetSpeedX() > 0)
+ {
+ AddSpeedX(-0.1);
+ }
+ else
+ {
+ AddSpeedX(0.1);
+ }
}
break;
}