1
0

Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses

* Hopefully fixes #5094
This commit is contained in:
Tiger Wang
2021-01-05 02:13:02 +00:00
parent eeb63b8901
commit 9328afe65c
14 changed files with 204 additions and 88 deletions

View File

@@ -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);