summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wolf.cpp
diff options
context:
space:
mode:
authorTyler Encke <tylerenky@gmail.com>2016-02-18 22:07:17 +0100
committerEnky <tylerenky@gmail.com>2016-02-19 19:07:07 +0100
commitf29908ce77246d3431dbc489a95c3c932ccc4f98 (patch)
treee5bd9cf5b53cf9b5bdc6bcca55996179a58f17f7 /src/Mobs/Wolf.cpp
parentDon't remove water after ice block has been destroyed (diff)
downloadcuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.tar
cuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.tar.gz
cuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.tar.bz2
cuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.tar.lz
cuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.tar.xz
cuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.tar.zst
cuberite-f29908ce77246d3431dbc489a95c3c932ccc4f98.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Wolf.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index d188d91eb..da21468ca 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -344,10 +344,12 @@ void cWolf::TickFollowPlayer()
virtual bool Item(cPlayer * a_Player) override
{
OwnerPos = a_Player->GetPosition();
+ OwnerFlying = a_Player->IsFlying();
return true;
}
public:
Vector3d OwnerPos;
+ bool OwnerFlying;
} Callback;
if (m_World->DoWithPlayerByUUID(m_OwnerUUID, Callback))
@@ -356,9 +358,12 @@ void cWolf::TickFollowPlayer()
double Distance = (Callback.OwnerPos - GetPosition()).Length();
if (Distance > 20)
{
- Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
- TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
- SetTarget(nullptr);
+ if (!Callback.OwnerFlying)
+ {
+ Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
+ TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
+ SetTarget(nullptr);
+ }
}
if (Distance < 2)
{
@@ -371,7 +376,10 @@ void cWolf::TickFollowPlayer()
{
if (GetTarget() == nullptr)
{
- MoveToPosition(Callback.OwnerPos);
+ if (!Callback.OwnerFlying)
+ {
+ MoveToPosition(Callback.OwnerPos);
+ }
}
}
}