From 250e50c01e5ef9ed6eb8ec77f495f0150a8d5c32 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Mon, 18 Apr 2016 21:58:57 +0300 Subject: Fix issues below y = 0 --- src/Mobs/Monster.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Mobs/Monster.cpp') diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index a4cb9e63f..3b0fdd36c 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -667,10 +667,14 @@ void cMonster::InStateIdle(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) NIBBLETYPE BlockMeta; int RelX = static_cast(Destination.x) - Chunk->GetPosX() * cChunkDef::Width; int RelZ = static_cast(Destination.z) - Chunk->GetPosZ() * cChunkDef::Width; - Chunk->GetBlockTypeMeta(RelX, static_cast(Destination.y) - 1, RelZ, BlockType, BlockMeta); - if (BlockType != E_BLOCK_STATIONARY_WATER) // Idle mobs shouldn't enter water on purpose + int YBelowUs = static_cast(Destination.y) - 1; + if (YBelowUs >= 0) { - MoveToPosition(Destination); + Chunk->GetBlockTypeMeta(RelX, YBelowUs, RelZ, BlockType, BlockMeta); + if (BlockType != E_BLOCK_STATIONARY_WATER) // Idle mobs shouldn't enter water on purpose + { + MoveToPosition(Destination); + } } } } -- cgit v1.2.3