summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Horse.cpp
diff options
context:
space:
mode:
authortonibm19 <tonibm19@gmail.com>2013-10-15 17:09:43 +0200
committertonibm19 <tonibm19@gmail.com>2013-10-15 17:09:43 +0200
commit8147ccd13be96e8d4bec2aae33b8cc8ee84c5866 (patch)
tree894ededa769cad351432d88daa163745465c8186 /source/Mobs/Horse.cpp
parentAPIDump: Documented HOOK_PLAYER_PLACING_BLOCK. (diff)
downloadcuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.tar
cuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.tar.gz
cuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.tar.bz2
cuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.tar.lz
cuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.tar.xz
cuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.tar.zst
cuberite-8147ccd13be96e8d4bec2aae33b8cc8ee84c5866.zip
Diffstat (limited to '')
-rw-r--r--source/Mobs/Horse.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp
index 46e7969cc..1f2c28adf 100644
--- a/source/Mobs/Horse.cpp
+++ b/source/Mobs/Horse.cpp
@@ -1,4 +1,3 @@
-
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Horse.h"
@@ -107,6 +106,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);
+ }
}