summaryrefslogtreecommitdiffstats
path: root/src/Mobs/PassiveMonster.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-02-01 00:31:05 +0100
committerTycho <work.tycho+git@gmail.com>2014-02-01 00:31:05 +0100
commitfec17409d2f566af18bad269fe2c5c372a474ecb (patch)
tree93baa2311e38fddb86a68e550955c261ac96cf3b /src/Mobs/PassiveMonster.cpp
parentChanged signitures of Several BLockHandler Methods (diff)
parentContributors now match real life, and are alpha-sorted. (diff)
downloadcuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.gz
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.bz2
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.lz
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.xz
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.zst
cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.zip
Diffstat (limited to 'src/Mobs/PassiveMonster.cpp')
-rw-r--r--src/Mobs/PassiveMonster.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp
index d774d3170..904cd63cc 100644
--- a/src/Mobs/PassiveMonster.cpp
+++ b/src/Mobs/PassiveMonster.cpp
@@ -3,7 +3,7 @@
#include "PassiveMonster.h"
#include "../World.h"
-
+#include "../Entities/Player.h"
@@ -39,6 +39,20 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
{
CheckEventLostPlayer();
}
+ cItem FollowedItem = GetFollowedItem();
+ if (FollowedItem.IsEmpty())
+ {
+ return;
+ }
+ cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
+ if (a_Closest_Player != NULL)
+ {
+ if (a_Closest_Player->GetEquippedItem().IsEqual(FollowedItem))
+ {
+ Vector3d PlayerPos = a_Closest_Player->GetPosition();
+ MoveToPosition(PlayerPos);
+ }
+ }
}