summaryrefslogtreecommitdiffstats
path: root/source/Mobs
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-09 15:53:43 +0200
committermadmaxoft <github@xoft.cz>2013-08-10 08:22:53 +0200
commit72e28910170f777fab364b4ca216c726a3e3cc09 (patch)
tree11910f96c83e6dce3c3138948cc51d709719cde4 /source/Mobs
parentRenamed Plugin_NewLua to PluginLua. (diff)
downloadcuberite-72e28910170f777fab364b4ca216c726a3e3cc09.tar
cuberite-72e28910170f777fab364b4ca216c726a3e3cc09.tar.gz
cuberite-72e28910170f777fab364b4ca216c726a3e3cc09.tar.bz2
cuberite-72e28910170f777fab364b4ca216c726a3e3cc09.tar.lz
cuberite-72e28910170f777fab364b4ca216c726a3e3cc09.tar.xz
cuberite-72e28910170f777fab364b4ca216c726a3e3cc09.tar.zst
cuberite-72e28910170f777fab364b4ca216c726a3e3cc09.zip
Diffstat (limited to '')
-rw-r--r--source/Mobs/Squid.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp
index 76b1ed94f..cb796f5ec 100644
--- a/source/Mobs/Squid.cpp
+++ b/source/Mobs/Squid.cpp
@@ -36,9 +36,14 @@ void cSquid::Tick(float a_Dt, cChunk & a_Chunk)
Vector3d Pos = GetPosition();
// TODO: Not a real behavior, but cool :D
+ int RelY = (int)floor(Pos.y);
+ if ((RelY < 0) || (RelY >= cChunkDef::Height))
+ {
+ return;
+ }
int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
- if (!IsBlockWater(a_Chunk.GetBlock(RelX, (int)floor(Pos.y), RelZ)) && !IsOnFire())
+ if (!IsBlockWater(a_Chunk.GetBlock(RelX, RelY, RelZ)) && !IsOnFire())
{
// Burn for 10 ticks, then decide again
StartBurning(10);