summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Ocelot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Ocelot.cpp')
-rw-r--r--src/Mobs/Ocelot.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Mobs/Ocelot.cpp b/src/Mobs/Ocelot.cpp
index 02af45a7d..855a11627 100644
--- a/src/Mobs/Ocelot.cpp
+++ b/src/Mobs/Ocelot.cpp
@@ -47,12 +47,11 @@ void cOcelot::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
if (m_CheckPlayerTickCount == 23)
{
- cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), 10, true);
- if (a_Closest_Player != nullptr)
+ m_World->DoWithNearestPlayer(GetPosition(), 10, [&](cPlayer & a_Player) -> bool
{
cItems Items;
GetBreedingItems(Items);
- if (Items.ContainsType(a_Closest_Player->GetEquippedItem().m_ItemType))
+ if (Items.ContainsType(a_Player.GetEquippedItem().m_ItemType))
{
if (!IsBegging())
{
@@ -60,7 +59,7 @@ void cOcelot::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_World->BroadcastEntityMetadata(*this);
}
- MoveToPosition(a_Closest_Player->GetPosition());
+ MoveToPosition(a_Player.GetPosition());
}
else
{
@@ -70,8 +69,9 @@ void cOcelot::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_World->BroadcastEntityMetadata(*this);
}
}
- }
+ return true;
+ }, true);
m_CheckPlayerTickCount = 0;
}
else