Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <EnderChestEntity.h>
Public Member Functions | |
cEnderChestEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World) | |
virtual void | OnRemoveFromWorld () override |
Called when the block entity object is removed from a world. More... | |
void | OpenNewWindow (void) |
Opens a new enderchest window for this enderchest. More... | |
virtual void | SendTo (cClientHandle &a_Client) override |
Sends the packet defining the block entity to the client specified. More... | |
virtual bool | UsedBy (cPlayer *a_Player) override |
Called when a player uses this entity; should open the UI window. More... | |
Public Member Functions inherited from cBlockEntity | |
OwnedBlockEntity | Clone (Vector3i a_Pos) |
Makes an exact copy of this block entity, except for its m_World (set to nullptr), and at a new position. More... | |
virtual cItems | ConvertToPickups () const |
Returns the contents of this block entity that it would drop if broken. More... | |
virtual void | CopyFrom (const cBlockEntity &a_Src) |
Copies all properties of a_Src into this entity, except for its m_World and location. More... | |
virtual void | Destroy () |
Called when this block entity's associated block is destroyed. More... | |
BLOCKTYPE | GetBlockType () const |
int | GetChunkX () const |
int | GetChunkZ () const |
Vector3i | GetPos () const |
int | GetPosX () const |
int | GetPosY () const |
int | GetPosZ () const |
Vector3i | GetRelPos () const |
int | GetRelX () const |
int | GetRelZ () const |
cWorld * | GetWorld () const |
virtual void | OnAddToWorld (cWorld &a_World, cChunk &a_Chunk) |
Called when the block entity object is added to a world. More... | |
void | SetPos (Vector3i a_NewPos) |
Updates the internally stored position. More... | |
void | SetWorld (cWorld *a_World) |
virtual bool | Tick (std::chrono::milliseconds a_Dt, cChunk &a_Chunk) |
Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. More... | |
virtual | ~cBlockEntity ()=default |
Public Member Functions inherited from cBlockEntityWindowOwner | |
cBlockEntityWindowOwner (cBlockEntity *a_BlockEntity) | |
virtual Vector3i | GetBlockPos (void) override |
Returns the block position at which the element owning the window is. More... | |
Public Member Functions inherited from cWindowOwner | |
void | CloseWindow (void) |
cWindowOwner () | |
cWindow * | GetWindow (void) const |
void | OpenWindow (cWindow *a_Window) |
virtual | ~cWindowOwner () |
Static Public Member Functions | |
static void | LoadFromJson (const Json::Value &a_Value, cItemGrid &a_Grid) |
static void | SaveToJson (Json::Value &a_Value, const cItemGrid &a_Grid) |
Static Public Member Functions inherited from cBlockEntity | |
static OwnedBlockEntity | CreateByBlockType (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World=nullptr) |
Creates a new block entity for the specified block type at the specified absolute pos. More... | |
static bool | IsBlockEntityBlockType (BLOCKTYPE a_BlockType) |
Returns true if the specified blocktype is supposed to have an associated block entity. More... | |
Private Types | |
using | Super = cBlockEntity |
Additional Inherited Members | |
Protected Member Functions inherited from cBlockEntity | |
cBlockEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World) | |
Protected Attributes inherited from cBlockEntity | |
NIBBLETYPE | m_BlockMeta |
The block meta representing this particular instance in the world Mainly used for directional entities, such as dispensers. More... | |
BLOCKTYPE | m_BlockType |
The blocktype representing this particular instance in the world. More... | |
Vector3i | m_Pos |
Position in absolute block coordinates. More... | |
int | m_RelX |
Position relative to the chunk, used to speed up ticking. More... | |
int | m_RelZ |
cWorld * | m_World |
Definition at line 12 of file EnderChestEntity.h.
|
private |
Definition at line 18 of file EnderChestEntity.h.
cEnderChestEntity::cEnderChestEntity | ( | BLOCKTYPE | a_BlockType, |
NIBBLETYPE | a_BlockMeta, | ||
Vector3i | a_Pos, | ||
cWorld * | a_World | ||
) |
Definition at line 17 of file EnderChestEntity.cpp.
|
static |
Definition at line 99 of file EnderChestEntity.cpp.
|
overridevirtual |
Called when the block entity object is removed from a world.
This occurs when the chunk it resides in is unloaded, or when the associated block is destroyed. If it is the latter, Destroy() is guaranteed to be called first.
Reimplemented from cBlockEntity.
Definition at line 38 of file EnderChestEntity.cpp.
void cEnderChestEntity::OpenNewWindow | ( | void | ) |
Opens a new enderchest window for this enderchest.
Definition at line 90 of file EnderChestEntity.cpp.
|
static |
Definition at line 115 of file EnderChestEntity.cpp.
|
overridevirtual |
Sends the packet defining the block entity to the client specified.
To send to all eligible clients, use cWorld::BroadcastBlockEntity()
Implements cBlockEntity.
Definition at line 28 of file EnderChestEntity.cpp.
|
overridevirtual |
Called when a player uses this entity; should open the UI window.
returns true if the use was successful, return false to use the block as a "normal" block
Implements cBlockEntity.
Definition at line 51 of file EnderChestEntity.cpp.