From 0fe1e50ffc744d861744e4aa4905e1b4b15e10fd Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 25 Mar 2014 10:32:58 +0200 Subject: Protocol: Wither metadata --- src/Mobs/Wither.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Mobs/Wither.cpp') diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp index 0e42194ac..790f127f2 100644 --- a/src/Mobs/Wither.cpp +++ b/src/Mobs/Wither.cpp @@ -21,6 +21,15 @@ cWither::cWither(void) : +bool cWither::IsArmored(void) const +{ + return GetHealth() <= (GetMaxHealth() / 2); +} + + + + + void cWither::DoTakeDamage(TakeDamageInfo & a_TDI) { if (a_TDI.DamageType == dtDrowning) @@ -33,6 +42,11 @@ void cWither::DoTakeDamage(TakeDamageInfo & a_TDI) return; } + if (IsArmored() && (a_TDI.DamageType == dtRangedAttack)) + { + return; + } + super::DoTakeDamage(a_TDI); } @@ -60,6 +74,8 @@ void cWither::Tick(float a_Dt, cChunk & a_Chunk) Heal(10); } } + + m_World->BroadcastEntityMetadata(*this); } -- cgit v1.2.3