![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <SignEntity.h>
Public Member Functions | |
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... | |
cSignEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World) | |
Creates a new empty sign entity at the specified block coords and block type (wall or standing). More... | |
AString | GetLine (size_t a_Index) const |
Retrieves individual line (zero-based index) More... | |
virtual void | SendTo (cClientHandle &a_Client) override |
Sends the packet defining the block entity to the client specified. More... | |
void | SetLine (size_t a_Index, const AString &a_Line) |
Sets individual line (zero-based index) More... | |
void | SetLines (const AString &a_Line1, const AString &a_Line2, const AString &a_Line3, const AString &a_Line4) |
Sets all the sign's lines. More... | |
virtual bool | UsedBy (cPlayer *a_Player) override |
Called when a player uses this entity; should open the UI window. More... | |
![]() | |
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 | 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 Attributes | |
std::array< AString, 4 > | m_Line |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
cBlockEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World) | |
![]() | |
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 SignEntity.h.
|
private |
Definition at line 24 of file SignEntity.h.
cSignEntity::cSignEntity | ( | BLOCKTYPE | a_BlockType, |
NIBBLETYPE | a_BlockMeta, | ||
Vector3i | a_Pos, | ||
cWorld * | a_World | ||
) |
Creates a new empty sign entity at the specified block coords and block type (wall or standing).
a_World may be nullptr
Definition at line 15 of file SignEntity.cpp.
|
overridevirtual |
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 26 of file SignEntity.cpp.
AString cSignEntity::GetLine | ( | size_t | a_Index | ) | const |
Retrieves individual line (zero-based index)
Definition at line 74 of file SignEntity.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 89 of file SignEntity.cpp.
void cSignEntity::SetLine | ( | size_t | a_Index, |
const AString & | a_Line | ||
) |
Sets individual line (zero-based index)
Definition at line 59 of file SignEntity.cpp.
void cSignEntity::SetLines | ( | const AString & | a_Line1, |
const AString & | a_Line2, | ||
const AString & | a_Line3, | ||
const AString & | a_Line4 | ||
) |
Sets all the sign's lines.
Definition at line 47 of file SignEntity.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 37 of file SignEntity.cpp.
|
private |
Definition at line 51 of file SignEntity.h.