diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-10-21 18:56:09 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-10-21 18:56:09 +0200 |
commit | 0bacda32692729e4b9743f91d92cd329e198d73a (patch) | |
tree | 6d5780aafb44679125145f3bc255a200a840c3c2 /src/Entities/Player.cpp | |
parent | Fixed some small passive mob issues (#4057) (diff) | |
download | cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.gz cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.bz2 cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.lz cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.xz cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.zst cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 0769499b1..22f0655f2 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -5,6 +5,7 @@ #include "Player.h" #include "Mobs/Wolf.h" +#include "Mobs/Horse.h" #include "../BoundingBox.h" #include "../ChatColor.h" #include "../Server.h" @@ -2202,6 +2203,35 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World) +void cPlayer::OpenHorseInventory() +{ + if ( + (m_AttachedTo == nullptr) || + !m_AttachedTo->IsMob() + ) + { + return; + } + + auto & Mob = static_cast<cMonster &>(*m_AttachedTo); + + if (Mob.GetMobType() != mtHorse) + { + return; + } + + auto & Horse = static_cast<cHorse &>(Mob); + // The client sends requests for untame horses as well but shouldn't actually open + if (Horse.IsTame()) + { + Horse.PlayerOpenWindow(*this); + } +} + + + + + bool cPlayer::SaveToDisk() { cFile::CreateFolder(FILE_IO_PREFIX + AString("players/")); // Create the "players" folder, if it doesn't exist yet (#1268) |