summaryrefslogtreecommitdiffstats
path: root/source/DispenserEntity.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-25 13:59:13 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-25 13:59:13 +0200
commitc640e9346c5e6c72b62b1beeaf5ec6de9cdc6924 (patch)
tree567565c41bab4e0fbab4eee5e3d2e647a896772c /source/DispenserEntity.h
parentFixed the cWorld:DoWithChestAt(), DoWithDispenserAt() and DoWithFurnaceAt() callbacks binding. (diff)
downloadcuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.gz
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.bz2
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.lz
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.xz
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.zst
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.zip
Diffstat (limited to '')
-rw-r--r--source/DispenserEntity.h38
1 files changed, 24 insertions, 14 deletions
diff --git a/source/DispenserEntity.h b/source/DispenserEntity.h
index ad755c7db..315452094 100644
--- a/source/DispenserEntity.h
+++ b/source/DispenserEntity.h
@@ -1,9 +1,8 @@
#pragma once
-#include "BlockEntity.h"
+#include "BlockEntityWithItems.h"
#include "UI/WindowOwner.h"
-#include "ItemGrid.h"
@@ -21,14 +20,29 @@ class cServer;
+// tolua_begin
class cDispenserEntity :
- public cBlockEntity,
+ public cBlockEntityWithItems,
public cBlockEntityWindowOwner
{
+ typedef cBlockEntityWithItems super;
+
public:
- cDispenserEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
+ enum {
+ ContentsHeight = 3,
+ ContentsWidth = 3,
+ } ;
+
+ /// Constructor used while generating a chunk; sets m_World to NULL
+ cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
+
+ // tolua_end
+
+ /// Constructor used for normal operation
+ cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual ~cDispenserEntity();
- virtual void Destroy(void);
+
+ static const char * GetClassStatic(void) { return "cDispenserEntity"; }
bool LoadFromJson(const Json::Value & a_Value);
@@ -38,22 +52,18 @@ public:
virtual bool Tick(float a_Dt) override;
virtual void UsedBy(cPlayer * a_Player) override;
- const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); }
+ // tolua_begin
- void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); }
-
/// Sets the dispenser to dispense an item in the next tick
void Activate(void);
- const cItemGrid & GetContents(void) const { return m_Contents; }
- cItemGrid & GetContents(void) { return m_Contents; }
-
+ // tolua_end
+
private:
- cItemGrid m_Contents;
- bool m_ShouldDispense; ///< If true, the dispenser will dispense an item in the next tick
+ bool m_ShouldDispense; ///< If true, the dispenser will dispense an item in the next tick
void Dispense(void);
-};
+} ; // tolua_export