2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2013-05-25 11:59:13 +00:00
|
|
|
#include "BlockEntityWithItems.h"
|
2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Json
|
|
|
|
{
|
|
|
|
class Value;
|
|
|
|
};
|
|
|
|
|
|
|
|
class cClientHandle;
|
|
|
|
class cServer;
|
|
|
|
class cNBTData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-16 21:02:28 +00:00
|
|
|
// tolua_begin
|
|
|
|
class cChestEntity :
|
2014-02-12 22:01:22 +00:00
|
|
|
public cBlockEntityWithItems
|
2013-04-06 21:21:57 +00:00
|
|
|
{
|
2013-05-25 11:59:13 +00:00
|
|
|
typedef cBlockEntityWithItems super;
|
2013-04-06 21:21:57 +00:00
|
|
|
|
2012-06-14 13:06:06 +00:00
|
|
|
public:
|
2014-07-19 13:23:40 +00:00
|
|
|
enum
|
|
|
|
{
|
2013-05-25 11:59:13 +00:00
|
|
|
ContentsHeight = 3,
|
|
|
|
ContentsWidth = 9,
|
|
|
|
} ;
|
|
|
|
|
2013-04-06 21:21:57 +00:00
|
|
|
// tolua_end
|
|
|
|
|
2014-07-12 21:30:34 +00:00
|
|
|
/** Constructor used for normal operation */
|
2014-07-06 22:50:22 +00:00
|
|
|
cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World, BLOCKTYPE a_Type);
|
2013-04-06 21:21:57 +00:00
|
|
|
|
2012-06-14 13:06:06 +00:00
|
|
|
virtual ~cChestEntity();
|
|
|
|
|
2013-05-25 11:59:13 +00:00
|
|
|
static const char * GetClassStatic(void) { return "cChestEntity"; }
|
2013-02-02 23:55:29 +00:00
|
|
|
|
2013-06-13 06:13:56 +00:00
|
|
|
bool LoadFromJson(const Json::Value & a_Value);
|
2012-10-20 21:53:09 +00:00
|
|
|
|
|
|
|
// cBlockEntity overrides:
|
2013-06-13 06:13:56 +00:00
|
|
|
virtual void SaveToJson(Json::Value & a_Value) override;
|
2012-08-24 07:58:26 +00:00
|
|
|
virtual void SendTo(cClientHandle & a_Client) override;
|
2013-06-13 06:13:56 +00:00
|
|
|
virtual void UsedBy(cPlayer * a_Player) override;
|
2012-10-20 21:53:09 +00:00
|
|
|
|
2014-07-12 21:30:34 +00:00
|
|
|
/** Opens a new chest window for this chest.
|
|
|
|
Scans for neighbors to open a double chest window, if appropriate. */
|
2012-10-20 21:53:09 +00:00
|
|
|
void OpenNewWindow(void);
|
2014-07-06 22:50:22 +00:00
|
|
|
|
|
|
|
/** Gets the number of players who currently have this chest open */
|
2014-07-12 21:30:34 +00:00
|
|
|
int GetNumberOfPlayers(void) const { return m_NumActivePlayers; }
|
2014-07-06 22:50:22 +00:00
|
|
|
|
2014-07-12 21:30:34 +00:00
|
|
|
/** Sets the number of players who currently have this chest open */
|
|
|
|
void SetNumberOfPlayers(int a_NumActivePlayers) { m_NumActivePlayers = a_NumActivePlayers; }
|
2014-07-06 22:50:22 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-07-12 21:30:34 +00:00
|
|
|
/** Number of players who currently have this chest open */
|
|
|
|
int m_NumActivePlayers;
|
2013-04-06 21:21:57 +00:00
|
|
|
} ; // tolua_export
|
2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|