summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Enderman.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Enderman.cpp')
-rw-r--r--src/Mobs/Enderman.cpp32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 000496df0..b7013affd 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -194,37 +194,13 @@ void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
// Take damage when touching water, drowning damage seems to be most appropriate
- if (CheckRain() || IsSwimming())
+ if (
+ cChunkDef::IsValidHeight(POSY_TOINT) &&
+ (GetWorld()->IsWeatherWetAtXYZ(GetPosition().Floor()) || IsSwimming())
+ )
{
EventLosePlayer();
TakeDamage(dtDrowning, nullptr, 1, 0);
// TODO teleport to a safe location
}
}
-
-
-
-
-
-bool cEnderman::CheckRain(void)
-{
- if (!GetWorld()->IsWeatherRain())
- {
- return false;
- }
-
- Vector3d coords = GetPosition();
- for (int Y = static_cast<int>(coords.y); Y < cChunkDef::Height; ++Y)
- {
- BLOCKTYPE Block = m_World->GetBlock(static_cast<int>(coords.x), Y, static_cast<int>(coords.z));
- if (Block != E_BLOCK_AIR)
- {
- return false;
- }
- }
- return true;
-}
-
-
-
-