summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-05-28 20:59:37 +0200
committerMattes D <github@xoft.cz>2017-05-28 20:59:37 +0200
commitbc6e2100c1cb5c695856e2a86afd202dec715967 (patch)
tree68a8099d937759373ee81e8a2ddc196bbf99144b /src
parentFixed tracer usage in Entity physics handling. (#3720) (diff)
downloadcuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar
cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.gz
cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.bz2
cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.lz
cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.xz
cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.tar.zst
cuberite-bc6e2100c1cb5c695856e2a86afd202dec715967.zip
Diffstat (limited to 'src')
-rw-r--r--src/LineBlockTracer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index 42e827cb9..d23c5a09e 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -122,7 +122,11 @@ bool cLineBlockTracer::FirstSolidHitTrace(
cBoundingBox bb(a_BlockX, a_BlockX + 1, a_BlockY, a_BlockY + 1, a_BlockZ, a_BlockZ + 1); // Bounding box of the block hit
double LineCoeff = 0; // Used to calculate where along the line an intersection with the bounding box occurs
eBlockFace Face; // Face hit
- VERIFY(bb.CalcLineIntersection(m_Start, m_End, LineCoeff, Face));
+ if (!bb.CalcLineIntersection(m_Start, m_End, LineCoeff, Face))
+ {
+ // Math rounding errors have caused the calculation to miss the block completely, assume immediate hit
+ LineCoeff = 0;
+ }
m_HitCoords = m_Start + (m_End - m_Start) * LineCoeff; // Point where projectile goes into the hit block
return true;
}