summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/BlockEntityWithItems.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-06-15 15:32:33 +0200
committerLukas Pioch <lukas@zgow.de>2017-06-16 14:11:28 +0200
commit0dd1cd750bb51403d85a226a97a5ad93eb99b144 (patch)
tree8c7a4e8580a780e1ed27f4141c32de7ec3087710 /src/BlockEntities/BlockEntityWithItems.h
parentChoose # of threads based on system info (#3644) (diff)
downloadcuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.tar
cuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.tar.gz
cuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.tar.bz2
cuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.tar.lz
cuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.tar.xz
cuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.tar.zst
cuberite-0dd1cd750bb51403d85a226a97a5ad93eb99b144.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/BlockEntityWithItems.h41
1 files changed, 9 insertions, 32 deletions
diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h
index 39540d630..65fdf3c0d 100644
--- a/src/BlockEntities/BlockEntityWithItems.h
+++ b/src/BlockEntities/BlockEntityWithItems.h
@@ -26,35 +26,25 @@ class cBlockEntityWithItems :
// tolua_begin
public cBlockEntityWindowOwner
{
- typedef cBlockEntity super;
+ typedef cBlockEntity Super;
public:
// tolua_end
BLOCKENTITY_PROTODEF(cBlockEntityWithItems)
+
cBlockEntityWithItems(
BLOCKTYPE a_BlockType, // Type of the block that the entity represents
+ NIBBLETYPE a_BlockMeta, // Meta of the block that the entity represents
int a_BlockX, int a_BlockY, int a_BlockZ, // Position of the block entity
int a_ItemGridWidth, int a_ItemGridHeight, // Dimensions of the ItemGrid
cWorld * a_World // Optional world to assign to the entity
- ) :
- super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World),
- cBlockEntityWindowOwner(this),
- m_Contents(a_ItemGridWidth, a_ItemGridHeight)
- {
- m_Contents.AddListener(*this);
- }
-
- virtual void Destroy(void) override
- {
- // Drop the contents as pickups:
- ASSERT(m_World != nullptr);
- cItems Pickups;
- m_Contents.CopyToItems(Pickups);
- m_Contents.Clear();
- m_World->SpawnItemPickups(Pickups, m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5); // Spawn in centre of block
- }
+ );
+
+ // cBlockEntity overrides:
+ virtual void Destroy(void) override;
+ virtual void CopyFrom(const cBlockEntity & a_Src) override;
// tolua_begin
@@ -76,20 +66,7 @@ protected:
cItemGrid m_Contents;
// cItemGrid::cListener overrides:
- virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override
- {
- UNUSED(a_SlotNum);
- ASSERT(a_Grid == &m_Contents);
- if (m_World != nullptr)
- {
- if (GetWindow() != nullptr)
- {
- GetWindow()->BroadcastWholeWindow();
- }
-
- m_World->MarkChunkDirty(GetChunkX(), GetChunkZ());
- }
- }
+ virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override;
} ; // tolua_export