summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-11-26 00:03:33 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-11-26 00:03:33 +0100
commit187bdab4fa90fbfa5b1979ea529dc9c0deac89d9 (patch)
treece15b54701666b6f5ecd9563df8b7103d88c29b0 /src/Mobs/Monster.cpp
parentRemoved unnecessary #includes (diff)
downloadcuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.tar
cuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.tar.gz
cuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.tar.bz2
cuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.tar.lz
cuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.tar.xz
cuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.tar.zst
cuberite-187bdab4fa90fbfa5b1979ea529dc9c0deac89d9.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index bcdc404c2..4f8afa0de 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -159,7 +159,7 @@ void cMonster::TickPathFinding()
BLOCKTYPE BlockAtYP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 1, gCrossCoords[i].z + PosZ);
BLOCKTYPE BlockAtYPP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 2, gCrossCoords[i].z + PosZ);
int LowestY = FindFirstNonAirBlockPosition(gCrossCoords[i].x + PosX, gCrossCoords[i].z + PosZ);
- BLOCKTYPE BlockAtLowestY = m_World->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ);
+ BLOCKTYPE BlockAtLowestY = (LowestY >= cChunkDef::Height) ? E_BLOCK_AIR : m_World->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ);
if (
(!cBlockInfo::IsSolid(BlockAtY)) &&
@@ -452,7 +452,7 @@ int cMonster::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ)
}
else
{
- while (cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY < cChunkDef::Height))
+ while ((PosY < cChunkDef::Height) && cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))))
{
PosY++;
}