Botcraft 26.2
Loading...
Searching...
No Matches
MagmaCubeEntity.cpp
Go to the documentation of this file.
2#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
4#endif
5
6namespace Botcraft
7{
9 {
10 // Initialize all attributes with default values
12#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
13 // As MagmaCube don't inherit from MonsterEntity, AttackDamage is not initialized in parent constructor
14 // It is overwritten when size is set, but it needs to be initialized before
16#endif
17 }
18
23
24
25 std::string MagmaCubeEntity::GetName() const
26 {
27 return "magma_cube";
28 }
29
34
35
37 {
38 return "magma_cube";
39 }
40
45
46
47#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
48 void MagmaCubeEntity::SizeChanged(const int new_size)
49 {
52 if (it != attributes.end())
53 {
54 it->second.SetBaseValue(static_cast<double>(new_size));
55 }
56 else
57 {
58 LOG_WARNING("Trying to set attribute base value for " << EntityAttribute::Type::AttackDamage << " for a slime but it doesn't have this attribute");
59 }
61 if (it != attributes.end())
62 {
63 it->second.SetBaseValue(static_cast<double>(new_size) * 3.0);
64 }
65 else
66 {
67 LOG_WARNING("Trying to set attribute base value for " << EntityAttribute::Type::AttackDamage << " for a slime but it doesn't have this attribute");
68 }
69 }
70
72 {
73 return 0.52 * GetIdSizeImpl();
74 }
75
77 {
78 return 0.52 * GetIdSizeImpl();
79 }
80#endif
81
82}
#define LOG_WARNING(osstream)
Definition Logger.hpp:44
virtual void SizeChanged(const int new_size)
std::map< EntityAttribute::Type, EntityAttribute > attributes
static EntityType GetClassType()
virtual EntityType GetType() const override
virtual std::string GetName() const override
virtual double GetWidthImpl() const override
virtual double GetHeightImpl() const override
virtual void SizeChanged(const int new_size) override
static std::string GetClassName()