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
20  public cBlockEntity
21 {
22  // tolua_end
23 
25 
26 public: // tolua_export
27 
29  cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
30 
31 
32  // tolua_begin
33 
35  bool IsItemInPot(void) { return !m_Item.IsEmpty(); }
36 
38  cItem GetItem(void) const { return m_Item; }
39 
41  void SetItem(const cItem & a_Item) { m_Item = a_Item; }
42 
43  // tolua_end
44 
45  // cBlockEntity overrides:
46  virtual cItems ConvertToPickups() const override;
47  virtual void CopyFrom(const cBlockEntity & a_Src) override;
48  virtual bool UsedBy(cPlayer * a_Player) override;
49  virtual void SendTo(cClientHandle & a_Client) override;
50 
51  static bool IsFlower(short m_ItemType, short m_ItemData);
52 
53 private:
54 
56 } ; // tolua_export
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
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Definition: BlockEntity.cpp:32
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
bool IsItemInPot(void)
Is a flower in the pot?
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
void SetItem(const cItem &a_Item)
Set the item in the flower pot.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Creates a new flowerpot entity at the specified block coords.
static bool IsFlower(short m_ItemType, short m_ItemData)
cItem GetItem(void) const
Get the item in the flower pot.
virtual cItems ConvertToPickups() const override
Returns the contents of this block entity that it would drop if broken.
Definition: Player.h:29
Definition: Item.h:37
bool IsEmpty(void) const
Returns true if the item represents an empty stack - either the type is invalid, or count is zero.
Definition: Item.h:69
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
Definition: World.h:53