Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Types | Private Attributes | List of all members
cBedEntity Class Reference

#include <BedEntity.h>

Inheritance diagram for cBedEntity:
Inheritance graph
[legend]
Collaboration diagram for cBedEntity:
Collaboration graph
[legend]

Public Member Functions

 cBedEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World, short a_Color=E_META_WOOL_RED)
 
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...
 
short GetColor (void) const
 Returns the color of the bed. More...
 
bool IsPillowBlock (void)
 Returns true if this is the pillow block, it has then the meta 8. More...
 
virtual void SendTo (cClientHandle &a_Client) override
 Sends the packet defining the block entity to the client specified. More...
 
void SetColor (short a_Color)
 Set the color of the bed. 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
cBlockEntityClone (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 ()
 
BLOCKTYPE GetBlockType () const
 
int GetChunkX () const
 
int GetChunkZ () const
 
virtual const char * GetClass () const
 Returns the name of the topmost class (the most descendant). More...
 
virtual const char * GetParentClass () const
 Returns the name of the parent class, or empty string if no parent class. More...
 
Vector3i GetPos () const
 
int GetPosX () const
 
int GetPosY () const
 
int GetPosZ () const
 
Vector3i GetRelPos () const
 
int GetRelX () const
 
int GetRelZ () const
 
cWorldGetWorld () const
 
virtual bool IsA (const char *a_ClassName) const
 Returns true if the object is the specified class, or its descendant. 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 ()
 

Private Types

using super = cBlockEntity
 

Private Attributes

short m_Color
 

Additional Inherited Members

- Static Public Member Functions inherited from cBlockEntity
static cBlockEntityCreateByBlockType (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 const char * GetClassStatic ()
 
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
 
cWorldm_World
 

Detailed Description

Definition at line 14 of file BedEntity.h.

Member Typedef Documentation

Definition at line 18 of file BedEntity.h.

Constructor & Destructor Documentation

cBedEntity::cBedEntity ( BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta,
Vector3i  a_Pos,
cWorld a_World,
short  a_Color = E_META_WOOL_RED 
)

Definition at line 16 of file BedEntity.cpp.

Member Function Documentation

void cBedEntity::CopyFrom ( const cBlockEntity a_Src)
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 27 of file BedEntity.cpp.

short cBedEntity::GetColor ( void  ) const
inline

Returns the color of the bed.

Definition at line 29 of file BedEntity.h.

bool cBedEntity::IsPillowBlock ( void  )
inline

Returns true if this is the pillow block, it has then the meta 8.

Definition at line 35 of file BedEntity.h.

void cBedEntity::SendTo ( cClientHandle a_Client)
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 38 of file BedEntity.cpp.

void cBedEntity::SetColor ( short  a_Color)

Set the color of the bed.

Definition at line 47 of file BedEntity.cpp.

virtual bool cBedEntity::UsedBy ( cPlayer a_Player)
inlineoverridevirtual

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 41 of file BedEntity.h.

Member Data Documentation

short cBedEntity::m_Color
private

Definition at line 45 of file BedEntity.h.


The documentation for this class was generated from the following files: