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  m_World->BroadcastSoundEffect("entity.painting.place", GetPosition(), 1, 1);
29 }
30 
31 
32 
33 
34 
35 void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
36 {
37  a_Items.emplace_back(E_ITEM_PAINTING);
38 }
39 
40 
41 
42 
43 
45 {
46  Super::KilledBy(a_TDI);
47 
48  m_World->BroadcastSoundEffect("entity.painting.break", GetPosition(), 1, 1);
49 }
@ E_ITEM_PAINTING
Definition: BlockType.h:365
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
Definition: Defines.h:38
std::string AString
Definition: StringUtils.h:11
void SendPaintingSpawn(const cPainting &a_Painting)
Definition: Entity.h:76
cWorld * m_World
Definition: Entity.h:624
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Definition: Entity.h:297
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
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...
cPainting(const AString &a_Name, eBlockFace a_Direction, Vector3d a_Pos)
Definition: Painting.cpp:13
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:35
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
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
Definition: Painting.cpp:44
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override