|
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Go to the documentation of this file.
81 virtual bool Tick(std::chrono::milliseconds a_Dt,
cChunk & a_Chunk);
virtual bool UsedBy(cPlayer *a_Player)=0
Called when a player uses this entity; should open the UI window.
cWorld * GetWorld() const
NIBBLETYPE m_BlockMeta
The block meta representing this particular instance in the world Mainly used for directional entitie...
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
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.
virtual void OnAddToWorld(cWorld &a_World, cChunk &a_Chunk)
Called when the block entity object is added to a world.
static bool IsBlockEntityBlockType(BLOCKTYPE a_BlockType)
Returns true if the specified blocktype is supposed to have an associated block entity.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
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.
virtual void OnRemoveFromWorld()
Called when the block entity object is removed from a world.
void SetPos(Vector3i a_NewPos)
Updates the internally stored position.
OwnedBlockEntity Clone(Vector3i a_Pos)
Makes an exact copy of this block entity, except for its m_World (set to nullptr),...
Vector3i GetRelPos() const
BLOCKTYPE m_BlockType
The blocktype representing this particular instance in the world.
std::unique_ptr< cBlockEntity > OwnedBlockEntity
virtual cItems ConvertToPickups() const
Returns the contents of this block entity that it would drop if broken.
std::unordered_map< size_t, OwnedBlockEntity > cBlockEntities
This class bridges a vector of cItem for safe access via Lua.
virtual void Destroy()
Called when this block entity's associated block is destroyed.
unsigned char BLOCKTYPE
The datatype used by blockdata.
virtual ~cBlockEntity()=default
#define FAST_FLOOR_DIV(x, div)
Faster than (int)floorf((float)x / (float)div)
Vector3i m_Pos
Position in absolute block coordinates.
virtual void CopyFrom(const cBlockEntity &a_Src)
Copies all properties of a_Src into this entity, except for its m_World and location.
int m_RelX
Position relative to the chunk, used to speed up ticking.
BLOCKTYPE GetBlockType() const
virtual void SendTo(cClientHandle &a_Client)=0
Sends the packet defining the block entity to the client specified.
void SetWorld(cWorld *a_World)