diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-25 08:36:59 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-25 08:36:59 +0200 |
commit | 4fe7801cfccbfa6f5a42ac2eb919287ef98ea611 (patch) | |
tree | 4afeac98622e2a49894164651af7b8d70d91d254 /source/Mobs/Monster.cpp | |
parent | ActivatorRail is craftable (Patch by tonibm19) (diff) | |
download | cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.tar cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.tar.gz cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.tar.bz2 cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.tar.lz cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.tar.xz cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.tar.zst cuberite-4fe7801cfccbfa6f5a42ac2eb919287ef98ea611.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Mobs/Monster.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp index 232143579..0176175e9 100644 --- a/source/Mobs/Monster.cpp +++ b/source/Mobs/Monster.cpp @@ -95,7 +95,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk) m_DestroyTimer += a_Dt / 1000; if (m_DestroyTimer > 1) { - Destroy(); + Destroy(true); } return; } @@ -134,7 +134,12 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk) { Vector3f NormSpeed = Vector3f(GetSpeed()).NormalizeCopy(); Vector3f NextBlock = Vector3f( GetPosition() ) + NormSpeed; - double NextHeight = (double)GetWorld()->GetHeight( (int)NextBlock.x, (int)NextBlock.z ); + int NextHeight; + if (!m_World->TryGetHeight((int)NextBlock.x, (int)NextBlock.z, NextHeight)) + { + // The chunk at NextBlock is not loaded + return; + } if( NextHeight > (GetPosY() - 1.0) && (NextHeight - GetPosY()) < 2.5 ) { m_bOnGround = false; |