summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Ocelot.cpp
diff options
context:
space:
mode:
authorchangyong guo <guo1487@163.com>2018-08-02 16:59:10 +0200
committerpeterbell10 <peterbell10@live.co.uk>2018-08-02 16:59:10 +0200
commit57690b81a24a29d70cb6f4196a6e0f521a3cb61b (patch)
treeac40e460dd92c9fe8a9554b0815684b67ecf2e11 /src/Mobs/Ocelot.cpp
parentOcelots no longer multiply exponentially (#4272) (diff)
downloadcuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.gz
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.bz2
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.lz
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.xz
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.zst
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.zip
Diffstat (limited to '')
-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