Cuberite
A lightweight, fast and extensible game server for Minecraft
BedEntity.h
Go to the documentation of this file.
1 
2 // BedEntity.h
3 
4 #pragma once
5 
6 #include "BlockEntity.h"
7 #include "../BlockType.h"
8 
9 
10 
11 
12 
13 // tolua_begin
14 
15 class cBedEntity :
16  public cBlockEntity
17 {
18  // tolua_end
20 
21 public: // tolua_export
22 
23  cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, short a_Color = E_META_WOOL_RED);
24 
25  // tolua_begin
26 
28  short GetColor(void) const { return m_Color; }
29 
31  void SetColor(short a_Color);
32 
34  bool IsPillowBlock(void) { return ((m_BlockMeta & 0x08) == 0x08); }
35 
36  // tolua_end
37 
38  // cBlockEntity overrides:
39  virtual cItems ConvertToPickups() const override;
40  virtual void CopyFrom(const cBlockEntity & a_Src) override;
41  virtual bool UsedBy(cPlayer * a_Player) override { return false; }
42  virtual void SendTo(cClientHandle & a_Client) override;
43 
44 private:
45 
46  short m_Color;
47 }; // tolua_export
cClientHandle
Definition: ClientHandle.h:49
cBedEntity
Definition: BedEntity.h:15
cBlockEntity::m_BlockMeta
NIBBLETYPE m_BlockMeta
The block meta representing this particular instance in the world Mainly used for directional entitie...
Definition: BlockEntity.h:124
cBlockEntity::cBlockEntity
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Definition: BlockEntity.cpp:32
cBedEntity::SendTo
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
Definition: BedEntity.cpp:47
NIBBLETYPE
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
cBedEntity::UsedBy
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
Definition: BedEntity.h:41
cBedEntity::m_Color
short m_Color
Definition: BedEntity.h:46
cWorld
Definition: World.h:47
cItems
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:213
BlockEntity.h
E_META_WOOL_RED
@ E_META_WOOL_RED
Definition: BlockType.h:1006
cBedEntity::SetColor
void SetColor(short a_Color)
Set the color of the bed.
Definition: BedEntity.cpp:56
BLOCKTYPE
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
cBedEntity::IsPillowBlock
bool IsPillowBlock(void)
Returns true if this is the pillow block, it has then the meta 8.
Definition: BedEntity.h:34
cBedEntity::CopyFrom
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
Definition: BedEntity.cpp:36
cPlayer
Definition: Player.h:27
cBedEntity::cBedEntity
cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World, short a_Color=E_META_WOOL_RED)
Definition: BedEntity.cpp:16
Vector3< int >
cBedEntity::GetColor
short GetColor(void) const
Returns the color of the bed.
Definition: BedEntity.h:28
cBedEntity::ConvertToPickups
virtual cItems ConvertToPickups() const override
Returns the contents of this block entity that it would drop if broken.
Definition: BedEntity.cpp:27
cBlockEntity
Definition: BlockEntity.h:24