summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wither.cpp
diff options
context:
space:
mode:
authorxdot <xdotftw@gmail.com>2014-05-21 10:14:44 +0200
committerxdot <xdotftw@gmail.com>2014-05-21 10:14:44 +0200
commit671c73c6396a1d5ec00bdf6578745b05a1c6ac83 (patch)
tree42aa3b9000120d4a8dcb9cb6625063adf49d4b61 /src/Mobs/Wither.cpp
parentFixed MCADefrag compilation. (diff)
parentFixed cWither::KilledBy (diff)
downloadcuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.tar
cuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.tar.gz
cuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.tar.bz2
cuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.tar.lz
cuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.tar.xz
cuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.tar.zst
cuberite-671c73c6396a1d5ec00bdf6578745b05a1c6ac83.zip
Diffstat (limited to 'src/Mobs/Wither.cpp')
-rw-r--r--src/Mobs/Wither.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp
index 5b6e895e1..170f4fdc0 100644
--- a/src/Mobs/Wither.cpp
+++ b/src/Mobs/Wither.cpp
@@ -2,7 +2,9 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Wither.h"
+
#include "../World.h"
+#include "../Entities/Player.h"
@@ -100,3 +102,35 @@ void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
+void cWither::KilledBy(cEntity * a_Killer)
+{
+ super::KilledBy(a_Killer);
+
+ class cPlayerCallback : public cPlayerListCallback
+ {
+ Vector3f m_Pos;
+
+ virtual bool Item(cPlayer * a_Player)
+ {
+ // TODO 2014-05-21 xdot: Vanilla minecraft uses an AABB check instead of a radius one
+ double Dist = (a_Player->GetPosition() - m_Pos).Length();
+ if (Dist < 50.0)
+ {
+ // If player is close, award achievement
+ a_Player->AwardAchievement(achKillWither);
+ }
+ return false;
+ }
+
+ public:
+ cPlayerCallback(const Vector3f & a_Pos) : m_Pos(a_Pos) {}
+
+ } PlayerCallback(GetPosition());
+
+ m_World->ForEachPlayer(PlayerCallback);
+}
+
+
+
+