summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwiseoldman95 <softwatt@gmx.com>2015-05-06 16:02:50 +0200
committerwiseoldman95 <softwatt@gmx.com>2015-05-06 19:01:06 +0200
commit40af96b100e88faaad451028856c46b0ba15de11 (patch)
tree3fa5cc49f48a2cab3c5db9e9e03174e62bd8f2e1
parentAI - Better shade cover (diff)
downloadcuberite-40af96b100e88faaad451028856c46b0ba15de11.tar
cuberite-40af96b100e88faaad451028856c46b0ba15de11.tar.gz
cuberite-40af96b100e88faaad451028856c46b0ba15de11.tar.bz2
cuberite-40af96b100e88faaad451028856c46b0ba15de11.tar.lz
cuberite-40af96b100e88faaad451028856c46b0ba15de11.tar.xz
cuberite-40af96b100e88faaad451028856c46b0ba15de11.tar.zst
cuberite-40af96b100e88faaad451028856c46b0ba15de11.zip
-rw-r--r--src/Mobs/Monster.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index c799e9394..84f58ff85 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -383,9 +383,9 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
2. I was not hurt by a player recently.
Then STOP. */
if (
- m_BurnsInDaylight && ((m_TicksSinceLastDamaged == 100) || (m_EMState == IDLE)) &&
- WouldBurnAt(m_NextWayPointPosition, *Chunk->GetNeighborChunk(FloorC(m_NextWayPointPosition.x), FloorC(m_NextWayPointPosition.z))) &&
- !WouldBurnAt(GetPosition(), *Chunk->GetNeighborChunk(FloorC(GetPosition().x), FloorC(GetPosition().z)))
+ m_BurnsInDaylight && ((m_TicksSinceLastDamaged >= 100) || (m_EMState == IDLE)) &&
+ WouldBurnAt(m_NextWayPointPosition, *Chunk) &&
+ !WouldBurnAt(GetPosition(), *Chunk)
)
{
// If we burn in daylight, and we would burn at the next step, and we won't burn where we are right now, and we weren't provoked recently:
@@ -1170,6 +1170,11 @@ void cMonster::HandleDaylightBurning(cChunk & a_Chunk, bool WouldBurn)
bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
{
+ cChunk * Chunk = a_Chunk.GetNeighborChunk(FloorC(m_NextWayPointPosition.x), FloorC(m_NextWayPointPosition.z));
+ if ((Chunk == nullptr) || (!Chunk->IsValid()))
+ {
+ return false;
+ }
int RelX = FloorC(a_Location.x) - a_Chunk.GetPosX() * cChunkDef::Width;
int RelY = FloorC(a_Location.y);
int RelZ = FloorC(a_Location.z) - a_Chunk.GetPosZ() * cChunkDef::Width;