Cuberite
A lightweight, fast and extensible game server for Minecraft
EnchantingTableEntity.cpp
Go to the documentation of this file.
1 
2 #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
3 
5 #include "../ClientHandle.h"
6 
7 
8 
9 
10 
11 cEnchantingTableEntity::cEnchantingTableEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, AString a_CustomName) :
12  Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
13  m_CustomName(std::move(a_CustomName))
14 {
15  ASSERT(a_BlockType == E_BLOCK_ENCHANTMENT_TABLE);
16 }
17 
18 
19 
20 
21 
23 {
25  Item.m_CustomName = m_CustomName;
26  return Item;
27 }
28 
29 
30 
31 
32 
34 {
35  Super::CopyFrom(a_Src);
36 
37  auto & Src = static_cast<const cEnchantingTableEntity &>(a_Src);
38  m_CustomName = Src.m_CustomName;
39 }
40 
41 
42 
43 
44 
46 {
47  UNUSED(a_Player);
48  return true;
49 }
50 
51 
52 
53 
54 
56 {
57  a_Client.SendUpdateBlockEntity(*this);
58 }
@ E_BLOCK_ENCHANTMENT_TABLE
Definition: BlockType.h:131
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
#define ASSERT(x)
Definition: Globals.h:276
#define UNUSED
Definition: Globals.h:72
Item
Definition: Items.h:4
std::string AString
Definition: StringUtils.h:11
Definition: FastNBT.h:132
virtual void CopyFrom(const cBlockEntity &a_Src)
Copies all properties of a_Src into this entity, except for its m_World and location.
Definition: BlockEntity.cpp:66
virtual cItems ConvertToPickups() const override
Returns the contents of this block entity that it would drop if broken.
cEnchantingTableEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World, AString a_CustomName="")
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity)
Definition: Player.h:29
Definition: Item.h:37
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
Definition: World.h:53