Botcraft 26.3
Loading...
Searching...
No Matches
HappyGhastEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
3
4namespace Botcraft
5{
21
26
27
28 std::string HappyGhastEntity::GetName() const
29 {
30 return "happy_ghast";
31 }
32
37
38
40 {
41 return "happy_ghast";
42 }
43
48
49
51 {
53
54 output["metadata"]["is_leash_holder"] = GetIsLeashHolder();
55 output["metadata"]["stays_still"] = GetStaysStill();
56
57 output["attributes"]["flying_speed"] = GetAttributeFlyingSpeedValue();
58
59 return output;
60 }
61
62
64 {
65 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("is_leash_holder"));
66 }
67
69 {
70 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("stays_still"));
71 }
72
73
74 void HappyGhastEntity::SetIsLeashHolder(const int is_leash_holder)
75 {
76 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("is_leash_holder"), is_leash_holder);
77 }
78
79 void HappyGhastEntity::SetStaysStill(const int stays_still)
80 {
81 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("stays_still"), stays_still);
82 }
83
84
86 {
87 std::shared_lock<std::shared_mutex> lock(entity_mutex);
89 }
90
91
93 {
94 return 4.0;
95 }
96
98 {
99 return 4.0;
100 }
101
102}
103#endif
virtual ProtocolCraft::Json::Value Serialize() 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
static constexpr int hierarchy_metadata_count
double GetAttributeFlyingSpeedValue() const
static EntityType GetClassType()
virtual std::string GetName() const override
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int metadata_count
void SetIsLeashHolder(const int is_leahs_holder)
virtual double GetWidthImpl() const override
virtual EntityType GetType() const override
virtual double GetHeightImpl() const override
static std::string GetClassName()
void SetStaysStill(const int stays_still)
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