Botcraft 26.3
Loading...
Searching...
No Matches
GhastEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
10
11 // Initialize all attributes with default values
14#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
17#endif
18 }
19
24
25
26 std::string GhastEntity::GetName() const
27 {
28 return "ghast";
29 }
30
35
36
38 {
39 return "ghast";
40 }
41
46
47
49 {
50#if PROTOCOL_VERSION < 771 /* < 1.21.6 */
51 ProtocolCraft::Json::Value output = FlyingMobEntity::Serialize();
52#else
54#endif
55
56 output["metadata"]["data_is_charging"] = GetDataIsCharging();
57
58#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
59 output["attributes"]["flying_speed"] = GetAttributeFlyingSpeedValue();
60#endif
61
62 return output;
63 }
64
65
67 {
68 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_is_charging"));
69 }
70
71
72 void GhastEntity::SetDataIsCharging(const bool data_is_charging)
73 {
74 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_is_charging"), data_is_charging);
75 }
76
77
78#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
80 {
81 std::shared_lock<std::shared_mutex> lock(entity_mutex);
83 }
84#endif
85
86
88 {
89 return 4.0;
90 }
91
93 {
94 return 4.0;
95 }
96
97}
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 metadata_count
bool GetDataIsCharging() const
virtual double GetHeightImpl() const override
static EntityType GetClassType()
virtual double GetWidthImpl() const override
static constexpr int hierarchy_metadata_count
static std::string GetClassName()
virtual EntityType GetType() const override
virtual std::string GetName() const override
double GetAttributeFlyingSpeedValue() const
void SetDataIsCharging(const bool data_is_charging)
virtual ProtocolCraft::Json::Value Serialize() const override
std::map< EntityAttribute::Type, EntityAttribute > attributes
virtual ProtocolCraft::Json::Value Serialize() const override
Definition MobEntity.cpp:29
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