summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Horse.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-15 22:14:47 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-15 22:14:47 +0200
commitcb9ccb36acfb1d80684098759f8f39c7022891dd (patch)
treef65f9ca3c1c70f447c41d9b7190bb5dc8fbb5071 /source/Mobs/Horse.cpp
parentMerge submodule changes (diff)
parentAdded HOOK_PLAYER_RIGHT_CLICK (diff)
downloadcuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.gz
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.bz2
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.lz
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.xz
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.tar.zst
cuberite-cb9ccb36acfb1d80684098759f8f39c7022891dd.zip
Diffstat (limited to 'source/Mobs/Horse.cpp')
-rw-r--r--source/Mobs/Horse.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp
index 46e7969cc..c2a8f6ed0 100644
--- a/source/Mobs/Horse.cpp
+++ b/source/Mobs/Horse.cpp
@@ -107,6 +107,18 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
m_TameAttemptTimes++;
a_Player.AttachTo(this);
+
+ if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE)
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
+
+ // Set saddle state & broadcast metadata
+ m_bIsSaddled = true;
+ m_World->BroadcastEntityMetadata(*this);
+ }
}