summaryrefslogtreecommitdiffstats
path: root/source/BlockEntityWithItems.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/BlockEntityWithItems.h')
-rw-r--r--source/BlockEntityWithItems.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/BlockEntityWithItems.h b/source/BlockEntityWithItems.h
index e5753359d..b160b8ed4 100644
--- a/source/BlockEntityWithItems.h
+++ b/source/BlockEntityWithItems.h
@@ -19,6 +19,10 @@
// tolua_begin
class cBlockEntityWithItems :
public cBlockEntity
+ // tolua_end
+ // tolua doesn't seem to support multiple inheritance?
+ , public cItemGrid::cListener
+ // tolua_begin
{
typedef cBlockEntity super;
@@ -34,6 +38,7 @@ public:
super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World),
m_Contents(a_ItemGridWidth, a_ItemGridHeight)
{
+ m_Contents.AddListener(*this);
}
virtual void Destroy(void) override
@@ -64,6 +69,14 @@ public:
protected:
cItemGrid m_Contents;
+
+ // cItemGrid::cListener overrides:
+ virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum)
+ {
+ ASSERT(a_Grid == &m_Contents);
+ ASSERT(m_World != NULL);
+ m_World->MarkChunkDirty(GetChunkX(), GetChunkZ());
+ }
} ; // tolua_export