From 9328afe65c72b29f5cedbf1897ea8559f6b2c42f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 5 Jan 2021 02:13:02 +0000 Subject: Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses * Hopefully fixes #5094 --- src/Mobs/Enderman.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Mobs/Enderman.cpp') diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index 02450487b..a107762c6 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -1,6 +1,7 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "Chunk.h" #include "Enderman.h" #include "../Entities/Player.h" #include "../LineBlockTracer.h" @@ -148,11 +149,14 @@ void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) return; } - // Take damage when wet - if ( - cChunkDef::IsValidHeight(POSY_TOINT) && - (GetWorld()->IsWeatherWetAtXYZ(GetPosition().Floor()) || IsInWater()) - ) + PREPARE_REL_AND_CHUNK(GetPosition().Floor(), a_Chunk); + if (!RelSuccess) + { + return; + } + + // Take damage when wet: + if (IsInWater() || Chunk->IsWeatherWetAt(Rel)) { EventLosePlayer(); TakeDamage(dtEnvironment, nullptr, 1, 0); -- cgit v1.2.3