summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authortonibm19 <tonibm19@gmail.com>2014-06-20 10:50:21 +0200
committertonibm19 <tonibm19@gmail.com>2014-06-20 10:50:21 +0200
commit3e15c92d18c344c95bd805d7795db990258eed5a (patch)
tree4660fd125014c43a0978fd7ccc80ba0509eb018a /src/Mobs
parentMerge pull request #1112 from mc-server/danglingptrs (diff)
downloadcuberite-3e15c92d18c344c95bd805d7795db990258eed5a.tar
cuberite-3e15c92d18c344c95bd805d7795db990258eed5a.tar.gz
cuberite-3e15c92d18c344c95bd805d7795db990258eed5a.tar.bz2
cuberite-3e15c92d18c344c95bd805d7795db990258eed5a.tar.lz
cuberite-3e15c92d18c344c95bd805d7795db990258eed5a.tar.xz
cuberite-3e15c92d18c344c95bd805d7795db990258eed5a.tar.zst
cuberite-3e15c92d18c344c95bd805d7795db990258eed5a.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Pig.cpp13
-rw-r--r--src/Mobs/Pig.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index e862f5aaa..ddd98eb94 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -76,5 +76,18 @@ void cPig::OnRightClicked(cPlayer & a_Player)
}
}
+void cPig::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+
+ if (m_bIsSaddled && m_Attachee != NULL)
+ {
+ if (m_Attachee->IsPlayer() && m_Attachee->GetEquippedWeapon().m_ItemType == E_ITEM_CARROT_ON_STICK)
+ {
+ MoveToPosition((m_Attachee->GetPosition()) + (m_Attachee->GetLookVector()*10));
+ m_bMovingToDestination = true;
+ }
+ }
+}
diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h
index d434324c1..313af2f44 100644
--- a/src/Mobs/Pig.h
+++ b/src/Mobs/Pig.h
@@ -19,6 +19,7 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_CARROT); }