summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockMobHead.h
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-05-20 14:52:59 +0200
committerandrew <xdotftw@gmail.com>2014-05-20 14:52:59 +0200
commit07baf9bdd3b04e3aec6e77f367eb38c0547f54ca (patch)
tree3d4c9f2202d7d9fae351e462701ddfa819d49489 /src/Blocks/BlockMobHead.h
parentThere's no "round" function in MSVC2008. (diff)
downloadcuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar
cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.gz
cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.bz2
cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.lz
cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.xz
cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.tar.zst
cuberite-07baf9bdd3b04e3aec6e77f367eb38c0547f54ca.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockMobHead.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h
index acd1c88fb..552c0491c 100644
--- a/src/Blocks/BlockMobHead.h
+++ b/src/Blocks/BlockMobHead.h
@@ -46,8 +46,29 @@ public:
bool IsWither(void) const { return m_IsWither; }
void Reset(void) { m_IsWither = false; }
+
} CallbackA, CallbackB;
+ class cPlayerCallback : public cPlayerListCallback
+ {
+ Vector3f m_Pos;
+
+ virtual bool Item(cPlayer * a_Player)
+ {
+ double Dist = (a_Player->GetPosition() - m_Pos).Length();
+ if (Dist < 50.0)
+ {
+ // If player is close, award achievement
+ a_Player->AwardAchievement(achSpawnWither);
+ }
+ return false;
+ }
+
+ public:
+ cPlayerCallback(const Vector3f & a_Pos) : m_Pos(a_Pos) {}
+
+ } PlayerCallback(Vector3f(a_BlockX, a_BlockY, a_BlockZ));
+
a_World->DoWithMobHeadAt(a_BlockX, a_BlockY, a_BlockZ, CallbackA);
if (!CallbackA.IsWither())
@@ -86,6 +107,9 @@ public:
// Spawn the wither:
a_World->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtWither);
+ // Award Achievement
+ a_World->ForEachPlayer(PlayerCallback);
+
return true;
}
@@ -113,6 +137,9 @@ public:
// Spawn the wither:
a_World->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtWither);
+ // Award Achievement
+ a_World->ForEachPlayer(PlayerCallback);
+
return true;
}