diff options
author | Pablo Beltrán <spekdrum@gmail.com> | 2017-05-21 11:48:33 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-05-21 11:48:33 +0200 |
commit | 758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6 (patch) | |
tree | 2a0d80ab3d82ba24fbf73138aebb0395116b7184 | |
parent | Don't destroy monster when last target type is a player (#3721) (diff) | |
download | cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.tar cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.tar.gz cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.tar.bz2 cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.tar.lz cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.tar.xz cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.tar.zst cuberite-758622336e6c8d7aa2d4b34d8eedc4aaed54a4f6.zip |
-rw-r--r-- | src/BlockEntities/ChestEntity.cpp | 7 | ||||
-rw-r--r-- | src/BlockEntities/EnderChestEntity.cpp | 11 | ||||
-rw-r--r-- | src/BlockEntities/EnderChestEntity.h | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp index 3791832e3..c3fb44a1b 100644 --- a/src/BlockEntities/ChestEntity.cpp +++ b/src/BlockEntities/ChestEntity.cpp @@ -5,6 +5,7 @@ #include "../Item.h" #include "../Entities/Player.h" #include "../UI/ChestWindow.h" +#include "../ClientHandle.h" @@ -35,10 +36,8 @@ cChestEntity::~cChestEntity() void cChestEntity::SendTo(cClientHandle & a_Client) { - // The chest entity doesn't need anything sent to the client when it's created / gets in the viewdistance - // All the actual handling is in the cWindow UI code that gets called when the chest is rclked - - UNUSED(a_Client); + // Send a dummy "number of players with chest open" packet to make the chest visible: + a_Client.SendBlockAction(m_PosX, m_PosY, m_PosZ, 1, 0, m_BlockType); } diff --git a/src/BlockEntities/EnderChestEntity.cpp b/src/BlockEntities/EnderChestEntity.cpp index 46d5912c3..86c8ec463 100644 --- a/src/BlockEntities/EnderChestEntity.cpp +++ b/src/BlockEntities/EnderChestEntity.cpp @@ -6,6 +6,7 @@ #include "../Item.h" #include "../Entities/Player.h" #include "../UI/EnderChestWindow.h" +#include "../ClientHandle.h" @@ -34,6 +35,16 @@ cEnderChestEntity::~cEnderChestEntity() +void cEnderChestEntity::SendTo(cClientHandle & a_Client) +{ + // Send a dummy "number of players with chest open" packet to make the chest visible: + a_Client.SendBlockAction(m_PosX, m_PosY, m_PosZ, 1, 0, m_BlockType); +} + + + + + bool cEnderChestEntity::UsedBy(cPlayer * a_Player) { // TODO: cats are an obstruction diff --git a/src/BlockEntities/EnderChestEntity.h b/src/BlockEntities/EnderChestEntity.h index d79e0ee68..f599ad391 100644 --- a/src/BlockEntities/EnderChestEntity.h +++ b/src/BlockEntities/EnderChestEntity.h @@ -25,7 +25,7 @@ public: // cBlockEntity overrides: virtual bool UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override { UNUSED(a_Client); } + virtual void SendTo(cClientHandle & a_Client) override; static void LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid); static void SaveToJson(Json::Value & a_Value, const cItemGrid & a_Grid); |