Botcraft 26.3
Loading...
Searching...
No Matches
AxolotlEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
3
4namespace Botcraft
5{
7 {
8 // Initialize all metadata with default values
11 SetDataPlayingDead(false);
12 SetFromBucket(false);
13
14 // Initialize all attributes with default values
18#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
20#endif
21
22 }
23
28
29
30 std::string AxolotlEntity::GetName() const
31 {
32 return "axolotl";
33 }
34
39
40
42 {
43 return "axolotl";
44 }
45
50
51
53 {
55
56 output["metadata"]["data_variant"] = GetDataVariant();
57 output["metadata"]["data_playing_dead"] = GetDataPlayingDead();
58 output["metadata"]["from_bucket"] = GetFromBucket();
59
60 output["attributes"]["attack_damage"] = GetAttributeAttackDamageValue();
61
62
63 return output;
64 }
65
66
68 {
69 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_variant"));
70 }
71
73 {
74 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_playing_dead"));
75 }
76
78 {
79 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("from_bucket"));
80 }
81
82
83 void AxolotlEntity::SetDataVariant(const int data_variant)
84 {
85 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_variant"), data_variant);
86 }
87
88 void AxolotlEntity::SetDataPlayingDead(const bool data_playing_dead)
89 {
90 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_playing_dead"), data_playing_dead);
91 }
92
93 void AxolotlEntity::SetFromBucket(const bool from_bucket)
94 {
95 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("from_bucket"), from_bucket);
96 }
97
98
100 {
101 std::shared_lock<std::shared_mutex> lock(entity_mutex);
103 }
104
105
107 {
108 return 0.75;
109 }
110
112 {
113 return 0.42;
114 }
115
116}
117#endif
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int hierarchy_metadata_count
static constexpr int metadata_count
static std::string GetClassName()
bool GetDataPlayingDead() const
void SetFromBucket(const bool from_bucket)
virtual double GetWidthImpl() const override
void SetDataPlayingDead(const bool data_playing_dead)
double GetAttributeAttackDamageValue() const
virtual EntityType GetType() const override
void SetDataVariant(const int data_variant)
static EntityType GetClassType()
virtual double GetHeightImpl() const override
virtual ProtocolCraft::Json::Value Serialize() const override
virtual std::string GetName() const override
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
std::shared_mutex entity_mutex
Definition Entity.hpp:320
std::vector< std::any > metadata
Definition Entity.hpp:335
std::map< EntityAttribute::Type, EntityAttribute > attributes
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45
#define BOTCRAFT_ENTITY_METADATA_INDEX(name)
Definition Entity.hpp:347