Cuberite
A lightweight, fast and extensible game server for Minecraft
FlowerPotEntity.h
Go to the documentation of this file.
1 // FlowerPotEntity.h
2 
3 // Declares the cFlowerPotEntity class representing a single sign in the world
4 
5 
6 
7 
8 
9 #pragma once
10 
11 #include "BlockEntity.h"
12 #include "../Item.h"
13 
14 
15 
16 
17 
18 // tolua_begin
19 
21  public cBlockEntity
22 {
23  // tolua_end
24 
26 
27 public: // tolua_export
28 
30 
31 
32  cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
33 
34 
35  // tolua_begin
36 
38  bool IsItemInPot(void) { return !m_Item.IsEmpty(); }
39 
41  cItem GetItem(void) const { return m_Item; }
42 
44  void SetItem(const cItem & a_Item) { m_Item = a_Item; }
45 
46  // tolua_end
47 
48  // cBlockEntity overrides:
49  virtual void Destroy(void) override;
50  virtual void CopyFrom(const cBlockEntity & a_Src) override;
51  virtual bool UsedBy(cPlayer * a_Player) override;
52  virtual void SendTo(cClientHandle & a_Client) override;
53 
54  static bool IsFlower(short m_ItemType, short m_ItemData);
55 
56 private:
57 
59 } ; // tolua_export
60 
61 
62 
63 
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
virtual void Destroy(void) override
Definition: Player.h:27
bool IsEmpty(void) const
Definition: Item.h:116
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
bool IsItemInPot(void)
Is a flower in the pot?
Definition: World.h:65
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
cItem GetItem(void) const
Get the item in the flower pot.
#define BLOCKENTITY_PROTODEF(classname)
Place this macro in the declaration of each cBlockEntity descendant.
Definition: BlockEntity.h:9
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Definition: BlockEntity.h:43
void SetItem(const cItem &a_Item)
Set the item in the flower pot.
static bool IsFlower(short m_ItemType, short m_ItemData)
Definition: Item.h:36