diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-02-06 19:37:03 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-02-07 23:36:15 +0100 |
commit | be2bf999c280d6892b38272d3f783b3462f0b745 (patch) | |
tree | 6567e7f011e50dd8e6f65f7dd933a1d7dc34ea93 /src/Entities/Minecart.cpp | |
parent | Adds playerlist header and footer broadcasting (1.8-1.13) (diff) | |
download | cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.gz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.bz2 cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.lz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.xz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.zst cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.zip |
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r-- | src/Entities/Minecart.cpp | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 3ddcea6ee..96eebe2fd 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -216,6 +216,9 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) m_DetectorRailPosition = Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT); } + // Enforce speed limit: + m_Speed.Clamp(MAX_SPEED_NEGATIVE, MAX_SPEED); + // Broadcast positioning changes to client BroadcastMovementUpdate(); } @@ -1268,40 +1271,6 @@ void cMinecart::ApplyAcceleration(Vector3d a_ForwardDirection, double a_Accelera -void cMinecart::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) -{ - if (a_SpeedX > MAX_SPEED) - { - a_SpeedX = MAX_SPEED; - } - else if (a_SpeedX < MAX_SPEED_NEGATIVE) - { - a_SpeedX = MAX_SPEED_NEGATIVE; - } - if (a_SpeedY > MAX_SPEED) - { - a_SpeedY = MAX_SPEED; - } - else if (a_SpeedY < MAX_SPEED_NEGATIVE) - { - a_SpeedY = MAX_SPEED_NEGATIVE; - } - if (a_SpeedZ > MAX_SPEED) - { - a_SpeedZ = MAX_SPEED; - } - else if (a_SpeedZ < MAX_SPEED_NEGATIVE) - { - a_SpeedZ = MAX_SPEED_NEGATIVE; - } - - Super::DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ); -} - - - - - //////////////////////////////////////////////////////////////////////////////// // cRideableMinecart: |