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

#include <MobHeadEntity.h>

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

Public Member Functions

 cMobHeadEntity (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
 Creates a new mob head entity at the specified block coords. More...
 
AString GetOwnerName (void) const
 Returns the player name of the mob head. More...
 
AString GetOwnerTexture (void) const
 Returns the texture of the mob head. More...
 
AString GetOwnerTextureSignature (void) const
 Returns the texture signature of the mob head. More...
 
cUUID GetOwnerUUID (void) const
 Returns the player UUID of the mob head. More...
 
eMobHeadRotation GetRotation (void) const
 Returns the rotation of the mob head. More...
 
eMobHeadType GetType (void) const
 Returns the type of the mob head. More...
 
void SetOwner (const cPlayer &a_Owner)
 Set the player for mob heads with player type. More...
 
void SetOwner (const cUUID &a_OwnerUUID, const AString &a_OwnerName, const AString &a_OwnerTexture, const AString &a_OwnerTextureSignature)
 Sets the player components for the mob heads with player type. More...
 
void SetRotation (eMobHeadRotation a_Rotation)
 Set the rotation of the mob head. More...
 
void SetType (const eMobHeadType &a_SkullType)
 Set the type of the mob head. 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 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
 
cWorldGetWorld () 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

AString m_OwnerName
 
AString m_OwnerTexture
 
AString m_OwnerTextureSignature
 
cUUID m_OwnerUUID
 
eMobHeadRotation m_Rotation
 
eMobHeadType m_Type
 

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
 
cWorldm_World
 

Detailed Description

Definition at line 21 of file MobHeadEntity.h.

Member Typedef Documentation

◆ Super

Definition at line 26 of file MobHeadEntity.h.

Constructor & Destructor Documentation

◆ cMobHeadEntity()

cMobHeadEntity::cMobHeadEntity ( BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta,
Vector3i  a_Pos,
cWorld a_World 
)

Creates a new mob head entity at the specified block coords.

a_World may be nullptr

Definition at line 16 of file MobHeadEntity.cpp.

Member Function Documentation

◆ ConvertToPickups()

cItems cMobHeadEntity::ConvertToPickups ( ) const
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 94 of file MobHeadEntity.cpp.

◆ CopyFrom()

void cMobHeadEntity::CopyFrom ( const cBlockEntity a_Src)
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 103 of file MobHeadEntity.cpp.

◆ GetOwnerName()

AString cMobHeadEntity::GetOwnerName ( void  ) const
inline

Returns the player name of the mob head.

Definition at line 51 of file MobHeadEntity.h.

◆ GetOwnerTexture()

AString cMobHeadEntity::GetOwnerTexture ( void  ) const
inline

Returns the texture of the mob head.

Definition at line 54 of file MobHeadEntity.h.

◆ GetOwnerTextureSignature()

AString cMobHeadEntity::GetOwnerTextureSignature ( void  ) const
inline

Returns the texture signature of the mob head.

Definition at line 57 of file MobHeadEntity.h.

◆ GetOwnerUUID()

cUUID cMobHeadEntity::GetOwnerUUID ( void  ) const
inline

Returns the player UUID of the mob head.

Definition at line 68 of file MobHeadEntity.h.

◆ GetRotation()

eMobHeadRotation cMobHeadEntity::GetRotation ( void  ) const
inline

Returns the rotation of the mob head.

Definition at line 48 of file MobHeadEntity.h.

◆ GetType()

eMobHeadType cMobHeadEntity::GetType ( void  ) const
inline

Returns the type of the mob head.

Definition at line 45 of file MobHeadEntity.h.

◆ SendTo()

void cMobHeadEntity::SendTo ( cClientHandle a_Client)
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 119 of file MobHeadEntity.cpp.

◆ SetOwner() [1/2]

void cMobHeadEntity::SetOwner ( const cPlayer a_Owner)

Set the player for mob heads with player type.

Definition at line 51 of file MobHeadEntity.cpp.

◆ SetOwner() [2/2]

void cMobHeadEntity::SetOwner ( const cUUID a_OwnerUUID,
const AString a_OwnerName,
const AString a_OwnerTexture,
const AString a_OwnerTextureSignature 
)

Sets the player components for the mob heads with player type.

Definition at line 77 of file MobHeadEntity.cpp.

◆ SetRotation()

void cMobHeadEntity::SetRotation ( eMobHeadRotation  a_Rotation)

Set the rotation of the mob head.

Definition at line 42 of file MobHeadEntity.cpp.

◆ SetType()

void cMobHeadEntity::SetType ( const eMobHeadType a_SkullType)

Set the type of the mob head.

Definition at line 28 of file MobHeadEntity.cpp.

◆ UsedBy()

bool cMobHeadEntity::UsedBy ( cPlayer a_Player)
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 130 of file MobHeadEntity.cpp.

Member Data Documentation

◆ m_OwnerName

AString cMobHeadEntity::m_OwnerName
private

Definition at line 75 of file MobHeadEntity.h.

◆ m_OwnerTexture

AString cMobHeadEntity::m_OwnerTexture
private

Definition at line 77 of file MobHeadEntity.h.

◆ m_OwnerTextureSignature

AString cMobHeadEntity::m_OwnerTextureSignature
private

Definition at line 78 of file MobHeadEntity.h.

◆ m_OwnerUUID

cUUID cMobHeadEntity::m_OwnerUUID
private

Definition at line 76 of file MobHeadEntity.h.

◆ m_Rotation

eMobHeadRotation cMobHeadEntity::m_Rotation
private

Definition at line 73 of file MobHeadEntity.h.

◆ m_Type

eMobHeadType cMobHeadEntity::m_Type
private

Definition at line 72 of file MobHeadEntity.h.


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