summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-17 09:01:22 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-17 09:01:22 +0100
commitf4049d8eaa2860fd583ab5965fa840cf510ccb91 (patch)
tree93f6ec8189082d18e7e9d20e732ee11b06843683 /src/Entities/Minecart.cpp
parentMerge pull request #3010 from LogicParrot/stringFix (diff)
parentFix minecart entity collision (diff)
downloadcuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.tar
cuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.tar.gz
cuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.tar.bz2
cuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.tar.lz
cuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.tar.xz
cuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.tar.zst
cuberite-f4049d8eaa2860fd583ab5965fa840cf510ccb91.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Minecart.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 9e91eec59..3adf5477e 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -845,24 +845,16 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
{
if (MinecartCollisionCallback.GetCollidedEntityPosition().z >= GetPosZ())
{
- if ((-GetSpeedZ() * 0.4) < 0.01)
+ if (GetSpeedZ() > 0) // True if minecart is moving into the direction of the entity
{
- AddSpeedZ(-4);
- }
- else
- {
- SetSpeedZ(-GetSpeedZ() * 0.4);
+ SetSpeedZ(0); // Entity handles the pushing
}
}
- else
+ else // if (MinecartCollisionCallback.GetCollidedEntityPosition().z < GetPosZ())
{
- if ((GetSpeedZ() * 0.4) < 0.01)
+ if (GetSpeedZ() < 0) // True if minecart is moving into the direction of the entity
{
- AddSpeedZ(4);
- }
- else
- {
- SetSpeedZ(GetSpeedZ() * 0.4);
+ SetSpeedZ(0); // Entity handles the pushing
}
}
return true;
@@ -871,24 +863,16 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
{
if (MinecartCollisionCallback.GetCollidedEntityPosition().x >= GetPosX())
{
- if ((-GetSpeedX() * 0.4) < 0.01)
+ if (GetSpeedX() > 0) // True if minecart is moving into the direction of the entity
{
- AddSpeedX(-4);
- }
- else
- {
- SetSpeedX(-GetSpeedX() * 0.4);
+ SetSpeedX(0); // Entity handles the pushing
}
}
- else
+ else // if (MinecartCollisionCallback.GetCollidedEntityPosition().x < GetPosX())
{
- if ((GetSpeedX() * 0.4) < 0.01)
- {
- AddSpeedX(4);
- }
- else
+ if (GetSpeedX() < 0) // True if minecart is moving into the direction of the entity
{
- SetSpeedX(GetSpeedX() * 0.4);
+ SetSpeedX(0); // Entity handles the pushing
}
}
return true;