diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-31 21:33:33 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-31 21:33:33 +0200 |
commit | 0836fe9a84e59b083db368205cbf6496355378bf (patch) | |
tree | b3d5a4b35d868380c5794d2cc1ff838cf2237906 /src/MobSpawner.cpp | |
parent | Fixed a few clang warnings. (diff) | |
download | cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.gz cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.bz2 cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.lz cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.xz cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.zst cuberite-0836fe9a84e59b083db368205cbf6496355378bf.zip |
Diffstat (limited to 'src/MobSpawner.cpp')
-rw-r--r-- | src/MobSpawner.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp index a0d0f5c54..216681b48 100644 --- a/src/MobSpawner.cpp +++ b/src/MobSpawner.cpp @@ -129,6 +129,11 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R BLOCKTYPE TargetBlock = E_BLOCK_AIR; if (m_AllowedTypes.find(a_MobType) != m_AllowedTypes.end() && a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, TargetBlock)) { + if ((a_RelY + 1 > cChunkDef::Height) || (a_RelY - 1 < 0)) + { + return false; + } + NIBBLETYPE BlockLight = a_Chunk->GetBlockLight(a_RelX, a_RelY, a_RelZ); NIBBLETYPE SkyLight = a_Chunk->GetSkyLight(a_RelX, a_RelY, a_RelZ); BLOCKTYPE BlockAbove = a_Chunk->GetBlock(a_RelX, a_RelY + 1, a_RelZ); @@ -212,11 +217,8 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R return false; } HaveFloor = ( - HaveFloor || - ( - a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY - 1, a_RelZ + z, TargetBlock) && - !cBlockInfo::IsTransparent(TargetBlock) - ) + a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY - 1 /* Checked at start of function */, a_RelZ + z, TargetBlock) && + !cBlockInfo::IsTransparent(TargetBlock) ); } } |