summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-12-14 21:31:33 +0100
committerworktycho <work.tycho@gmail.com>2015-12-14 21:31:33 +0100
commit1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84 (patch)
tree8adc41d291bdac3c83eb0c56933e7a29cd1c3942 /src/Entities/Entity.cpp
parentMerge pull request #2744 from cuberite/HopperMetaStrip (diff)
parentblockheight mechanism (diff)
downloadcuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.gz
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.bz2
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.lz
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.xz
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.zst
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.zip
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index f44dbe27c..4c84df1f4 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1029,16 +1029,17 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
NextSpeed.z = 0.0f;
}
- if (Tracer.HitNormal.y == 1.0f) // Hit BLOCK_FACE_YP, we are on the ground
- {
- m_bOnGround = true;
- }
-
// Now, set our position to the hit block (i.e. move part way along our intended trajectory)
NextPos.Set(Tracer.RealHit.x, Tracer.RealHit.y, Tracer.RealHit.z);
NextPos.x += Tracer.HitNormal.x * 0.1;
NextPos.y += Tracer.HitNormal.y * 0.05;
NextPos.z += Tracer.HitNormal.z * 0.1;
+
+ if (Tracer.HitNormal.y == 1.0f) // Hit BLOCK_FACE_YP, we are on the ground
+ {
+ m_bOnGround = true;
+ NextPos.y = FloorC(NextPos.y); // we clamp the height to 0 cos otherwise we'll constantly be slightly above the block
+ }
}
else
{