6 #include "../BlockInfo.h"
8 #include "../Entities/Player.h"
9 #include "../UI/EnderChestWindow.h"
10 #include "../ClientHandle.h"
11 #include "../Mobs/Ocelot.h"
18 Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
41 if (Window !=
nullptr)
43 Window->OwnerDestroyed();
69 if (Window ==
nullptr)
76 if (Window !=
nullptr)
102 for (
auto & Node : a_Value)
121 a_Value.append(Slot);
static int GetBlock(lua_State *a_LuaState)
Templated bindings for the GetBlock___() functions.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
Vector3< double > Vector3d
BLOCKTYPE m_BlockType
The blocktype representing this particular instance in the world.
cWorld * GetWorld() const
Vector3i m_Pos
Position in absolute block coordinates.
cEnderChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
static void LoadFromJson(const Json::Value &a_Value, cItemGrid &a_Grid)
void OpenNewWindow(void)
Opens a new enderchest window for this enderchest.
static void SaveToJson(Json::Value &a_Value, const cItemGrid &a_Grid)
virtual void OnRemoveFromWorld() override
Called when the block entity object is removed from a world.
static bool IsTransparent(BLOCKTYPE Block)
Is a block transparent? (https://minecraft.wiki/w/Opacity)
void SendBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
StatisticsManager & GetStatistics()
Return the associated statistic and achievement manager.
void OpenWindow(cWindow &a_Window)
Opens the specified window; closes the current one first using CloseWindow()
cWindow * GetWindow(void)
void GetJson(Json::Value &a_OutValue) const
Saves the item data into JSON representation.
void SetSlot(int a_X, int a_Y, const cItem &a_Item)
const cItem & GetSlot(int a_X, int a_Y) const
int GetNumSlots(void) const
static bool IsCatSittingOnBlock(cWorld *a_World, Vector3d a_BlockPosition)
Returns true if there's a cat sitting above the given position.
std::unordered_map< CustomStatistic, StatValue > Custom
cWindow * GetWindow(void) const
void OpenWindow(cWindow *a_Window)
Window owner that is associated with a block entity (chest, furnace, ...)