summaryrefslogtreecommitdiffstats
path: root/src/Tracer.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-06 21:44:55 +0200
committerMattes D <github@xoft.cz>2014-05-06 21:44:55 +0200
commite400b1acd8b0c1457f33bc1730996a3530fa0a4f (patch)
treecd26c0d2b87b62882bcc7b64503de408dd391e6f /src/Tracer.cpp
parentChanged cPieceGenerator to support pairings. (diff)
parentMerge branch 'master' into fixes (diff)
downloadcuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.tar
cuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.tar.gz
cuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.tar.bz2
cuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.tar.lz
cuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.tar.xz
cuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.tar.zst
cuberite-e400b1acd8b0c1457f33bc1730996a3530fa0a4f.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];
}