From c53406f0d4d83f795e2a445059952b61abb12f34 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 11 Feb 2014 22:04:11 +0000 Subject: Fixed #612 * Chests send contents updates to client --- src/BlockEntities/ChestEntity.cpp | 15 +++++++++++++++ src/BlockEntities/ChestEntity.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp index dfbe6ae87..9282da7fd 100644 --- a/src/BlockEntities/ChestEntity.cpp +++ b/src/BlockEntities/ChestEntity.cpp @@ -170,3 +170,18 @@ void cChestEntity::OpenNewWindow(void) + +void cChestEntity::OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) +{ + super::OnSlotChanged(a_Grid, a_SlotNum); + + cWindow * Window = GetWindow(); + if (Window != NULL) + { + Window->BroadcastWholeWindow(); + } +} + + + + diff --git a/src/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h index 4110de1f3..1f5668f78 100644 --- a/src/BlockEntities/ChestEntity.h +++ b/src/BlockEntities/ChestEntity.h @@ -49,6 +49,7 @@ public: virtual void SaveToJson(Json::Value & a_Value) override; virtual void SendTo(cClientHandle & a_Client) override; virtual void UsedBy(cPlayer * a_Player) override; + virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override; /// Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate. void OpenNewWindow(void); -- cgit v1.2.3