Cuberite
A lightweight, fast and extensible game server for Minecraft
MagmaCube.cpp
Go to the documentation of this file.
1 #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
2 
3 #include "MagmaCube.h"
4 
5 
6 
7 
8 
9 cMagmaCube::cMagmaCube(int a_Size) :
10  Super(
11  "MagmaCube",
13  fmt::format(FMT_STRING("entity.{}magmacube.hurt"), GetSizeName(a_Size)),
14  fmt::format(FMT_STRING("entity.{}magmacube.death"), GetSizeName(a_Size)),
15  "",
16  0.51f * a_Size,
17  0.51f * a_Size
18  ),
19  m_Size(a_Size)
20 {
21 }
22 
23 
24 
25 
26 
28 {
29  if (a_Size == 1)
30  {
31  return "small_";
32  }
33  return "";
34 }
35 
36 
37 
38 
39 
40 void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer)
41 {
42  UNUSED(a_Killer);
43  if (GetSize() > 1)
44  {
46  }
47 }
@ E_ITEM_MAGMA_CREAM
Definition: BlockType.h:424
#define UNUSED
Definition: Globals.h:72
@ mtMagmaCube
Definition: MonsterTypes.h:40
std::string AString
Definition: StringUtils.h:11
Implements custom fmtlib formatting for cChunkCoords.
Definition: ChunkDef.h:104
Definition: Entity.h:76
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
cMagmaCube(int a_Size)
Creates a MagmaCube of the specified size; with 1 being the smallest.
Definition: MagmaCube.cpp:9
int GetSize(void) const
Definition: MagmaCube.h:21
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: MagmaCube.cpp:40
static AString GetSizeName(int a_Size)
Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
Definition: MagmaCube.cpp:27
void AddRandomUncommonDropItem(cItems &a_Drops, float a_Chance, short a_Item, short a_ItemHealth=0)
Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops.
Definition: Monster.cpp:1537