diff options
author | tonibm19 <tonibm19@gmail.com> | 2014-01-29 18:08:33 +0100 |
---|---|---|
committer | tonibm19 <tonibm19@gmail.com> | 2014-01-29 18:08:33 +0100 |
commit | ebe0f9372fa8787b3fe709937ebd3af30810f910 (patch) | |
tree | f87c7dc6ca63110233d79f0cad14a506dc67c350 /src/Mobs/Chicken.cpp | |
parent | Limited sign lines to 15 chars. (diff) | |
download | cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.tar cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.tar.gz cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.tar.bz2 cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.tar.lz cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.tar.xz cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.tar.zst cuberite-ebe0f9372fa8787b3fe709937ebd3af30810f910.zip |
Diffstat (limited to 'src/Mobs/Chicken.cpp')
-rw-r--r-- | src/Mobs/Chicken.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp index 087fd088a..52c8d3788 100644 --- a/src/Mobs/Chicken.cpp +++ b/src/Mobs/Chicken.cpp @@ -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); + } + } + } } |