summaryrefslogtreecommitdiffstats
path: root/src/Tracer.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-04-23 22:06:46 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-04-23 22:06:46 +0200
commit7f5cf417de5e83641e6aa0998cc9dc8b377346b6 (patch)
treeeb33b435797e5b23675fd9bb625f4c54bbbdd9a2 /src/Tracer.cpp
parentSmall changes (diff)
downloadcuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.tar
cuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.tar.gz
cuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.tar.bz2
cuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.tar.lz
cuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.tar.xz
cuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.tar.zst
cuberite-7f5cf417de5e83641e6aa0998cc9dc8b377346b6.zip
Diffstat (limited to 'src/Tracer.cpp')
-rw-r--r--src/Tracer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index 6da6b2ad7..be42430a5 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -219,6 +219,10 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int
return false;
}
+ if ((pos.y < 0) || (pos.y >= cChunkDef::Height))
+ {
+ return false;
+ }
BLOCKTYPE BlockID = m_World->GetBlock(pos.x, pos.y, pos.z);
// Block is counted as a collision if we are not doing a line of sight and it is solid,
// or if the block is not air and not water. That way mobs can still see underwater.
@@ -226,7 +230,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int
{
BlockHitPosition = pos;
int Normal = GetHitNormal(a_Start, End, pos );
- if(Normal > 0)
+ if (Normal > 0)
{
HitNormal = m_NormalTable[Normal-1];
}