Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <BannerEntity.h>
Public Member Functions | |
cBannerEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World, unsigned char a_BaseColor=1, AString a_CustomName="") | |
unsigned char | GetBaseColor () const |
const AString & | GetCustomName () const |
void | SetBaseColor (unsigned char a_Color) |
void | SetCustomName (const AString &a_CustomName) |
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 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... | |
virtual void | OnRemoveFromWorld () |
Called when the block entity object is removed from 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 |
Private Types | |
using | Super = cBlockEntity |
Private Member Functions | |
virtual cItems | ConvertToPickups () const override |
Returns the contents of this block entity that it would drop if broken. More... | |
virtual void | CopyFrom (const cBlockEntity &a_Src) override |
Copies all properties of a_Src into this entity, except for its m_World and location. 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... | |
Private Attributes | |
unsigned char | m_BaseColor |
AString | m_CustomName |
Additional Inherited Members | |
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... | |
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 19 of file BannerEntity.h.
|
private |
Definition at line 24 of file BannerEntity.h.
cBannerEntity::cBannerEntity | ( | BLOCKTYPE | a_BlockType, |
NIBBLETYPE | a_BlockMeta, | ||
Vector3i | a_Pos, | ||
cWorld * | a_World, | ||
unsigned char | a_BaseColor = 1 , |
||
AString | a_CustomName = "" |
||
) |
Definition at line 16 of file BannerEntity.cpp.
|
overrideprivatevirtual |
Returns the contents of this block entity that it would drop if broken.
Note that the block handler will usually handle pickups for the block itself, in addition to any items returned here.
Reimplemented from cBlockEntity.
Definition at line 28 of file BannerEntity.cpp.
|
overrideprivatevirtual |
Copies all properties of a_Src into this entity, except for its m_World and location.
Each non-abstract descendant should override to copy its specific properties, and call Super::CopyFrom(a_Src) to copy the common ones.
Reimplemented from cBlockEntity.
Definition at line 39 of file BannerEntity.cpp.
|
inline |
Definition at line 30 of file BannerEntity.h.
|
inline |
Definition at line 33 of file BannerEntity.h.
|
overrideprivatevirtual |
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 51 of file BannerEntity.cpp.
|
inline |
Definition at line 31 of file BannerEntity.h.
|
inline |
Definition at line 34 of file BannerEntity.h.
|
overrideprivatevirtual |
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 61 of file BannerEntity.cpp.
|
private |
Definition at line 38 of file BannerEntity.h.
|
private |
Definition at line 40 of file BannerEntity.h.