Cuberite
A lightweight, fast and extensible game server for Minecraft
Painting.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 
4 #include "Painting.h"
5 #include "Player.h"
6 #include "../ClientHandle.h"
7 #include "../Chunk.h"
8 
9 
10 
11 
12 
13 cPainting::cPainting(const AString & a_Name, eBlockFace a_Direction, Vector3d a_Pos):
14  super(etPainting, a_Direction, a_Pos),
15  m_Name(a_Name)
16 {
17 }
18 
19 
20 
21 
22 
24 {
25  super::SpawnOn(a_Client);
26  a_Client.SendPaintingSpawn(*this);
27 }
28 
29 
30 
31 
32 
33 void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
34 {
35  if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !static_cast<cPlayer *>(a_Killer)->IsGameModeCreative())
36  {
37  a_Items.push_back(cItem(E_ITEM_PAINTING));
38  }
39 }
40 
41 
42 
43 
virtual void GetDrops(cItems &a_Items, cEntity *a_Killer) override
Returns the list of drops for this pawn when it is killed.
Definition: Painting.cpp:33
Definition: Player.h:27
virtual void SpawnOn(cClientHandle &a_ClientHandle) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
virtual void SpawnOn(cClientHandle &a_Client) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
Definition: Painting.cpp:23
void SendPaintingSpawn(const cPainting &a_Painting)
std::string AString
Definition: StringUtils.h:13
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
Definition: Defines.h:29
bool IsPlayer(void) const
Definition: Entity.h:171
Definition: Entity.h:73
Definition: Item.h:36
cPainting(const AString &a_Name, eBlockFace a_Direction, Vector3d a_Pos)
Definition: Painting.cpp:13
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:234