Properly implemented enderchests

This commit is contained in:
Tiger Wang
2014-06-29 11:36:38 +01:00
parent 3b3160d6b4
commit dde641ce83
10 changed files with 104 additions and 101 deletions
+14 -30
View File
@@ -1,20 +1,9 @@
#pragma once
#include "BlockEntityWithItems.h"
namespace Json
{
class Value;
};
class cClientHandle;
class cServer;
class cNBTData;
#include "BlockEntity.h"
#include "UI/WindowOwner.h"
#include "json/json.h"
@@ -22,33 +11,28 @@ class cNBTData;
// tolua_begin
class cEnderChestEntity :
public cBlockEntityWithItems
public cBlockEntity,
public cBlockEntityWindowOwner
{
typedef cBlockEntityWithItems super;
public:
enum {
ContentsHeight = 3,
ContentsWidth = 9,
} ;
typedef cBlockEntity super;
public:
// tolua_end
/// Constructor used for normal operation
cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual ~cEnderChestEntity();
static const char * GetClassStatic(void) { return "cEnderChestEntity"; }
bool LoadFromJson(const Json::Value & a_Value);
// cBlockEntity overrides:
virtual void SaveToJson(Json::Value & a_Value) override;
virtual void SendTo(cClientHandle & a_Client) override;
virtual void UsedBy(cPlayer * a_Player) override;
virtual void SaveToJson(Json::Value & a_Value) override { UNUSED(a_Value); }
virtual void SendTo(cClientHandle & a_Client) override { UNUSED(a_Client); }
static void LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid);
static void SaveToJson(Json::Value & a_Value, const cItemGrid & a_Grid);
/// Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate.
/** Opens a new enderchest window for this enderchest */
void OpenNewWindow(void);
} ; // tolua_export