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
@ E_META_WOOL_RED
Definition: BlockType.h:1006
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
void SetColor(short a_Color)
Set the color of the bed.
Definition: BedEntity.cpp:56
bool IsPillowBlock(void)
Returns true if this is the pillow block, it has then the meta 8.
Definition: BedEntity.h:34
short m_Color
Definition: BedEntity.h:46
virtual cItems ConvertToPickups() const override
Returns the contents of this block entity that it would drop if broken.
Definition: BedEntity.cpp:27
short GetColor(void) const
Returns the color of the bed.
Definition: BedEntity.h:28
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
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
Definition: BedEntity.h:41
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
Definition: BedEntity.cpp:47
cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World, short a_Color=E_META_WOOL_RED)
Definition: BedEntity.cpp:16
NIBBLETYPE m_BlockMeta
The block meta representing this particular instance in the world Mainly used for directional entitie...
Definition: BlockEntity.h:124
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Definition: BlockEntity.cpp:32
Definition: Player.h:29
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
Definition: World.h:53