diff options
author | Alexander Harkness <me@bearbin.net> | 2017-12-26 22:25:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-26 22:25:57 +0100 |
commit | 6309c6a97fdbabfde978358f5f9a0f61ab74f91f (patch) | |
tree | 18b76401b21bb16425d6a630e109d737afea6bb7 /src/Mobs | |
parent | .editorconfig fixes (#4113) (diff) | |
download | cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.tar cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.tar.gz cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.tar.bz2 cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.tar.lz cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.tar.xz cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.tar.zst cuberite-6309c6a97fdbabfde978358f5f9a0f61ab74f91f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Enderman.cpp | 32 | ||||
-rw-r--r-- | src/Mobs/Enderman.h | 6 |
2 files changed, 4 insertions, 34 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; -} - - - - diff --git a/src/Mobs/Enderman.h b/src/Mobs/Enderman.h index c9ffbeaba..d8731b709 100644 --- a/src/Mobs/Enderman.h +++ b/src/Mobs/Enderman.h @@ -29,8 +29,6 @@ public: /** Returns if the current sky light level is sufficient for the enderman to become aggravated */ bool CheckLight(void); - /** Returns if the enderman gets hit by the rain */ - bool CheckRain(void); private: @@ -39,7 +37,3 @@ private: NIBBLETYPE CarriedMeta; } ; - - - - |