Now mobs follow you when holding their breed item
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "Chicken.h"
|
||||
#include "../World.h"
|
||||
|
||||
#include "../Entities/Player.h"
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,29 @@ void cChicken::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
m_EggDropTimer++;
|
||||
}
|
||||
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
|
||||
if (a_Closest_Player != NULL)
|
||||
{
|
||||
if (a_Closest_Player->GetEquippedItem().m_ItemType == E_ITEM_SEEDS)
|
||||
{
|
||||
if (!IsBegging())
|
||||
{
|
||||
m_IsBegging = true;
|
||||
m_World->BroadcastEntityMetadata(*this);
|
||||
}
|
||||
Vector3d PlayerPos = a_Closest_Player->GetPosition();
|
||||
PlayerPos.y++;
|
||||
m_FinalDestination = PlayerPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsBegging())
|
||||
{
|
||||
m_IsBegging = false;
|
||||
m_World->BroadcastEntityMetadata(*this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user