diff options
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r-- | src/Entities/Minecart.cpp | 34 |
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; } |