Botcraft 26.3
Loading...
Searching...
No Matches
ParrotEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
19
24
25
26 std::string ParrotEntity::GetName() const
27 {
28 return "parrot";
29 }
30
35
36
38 {
39 return "parrot";
40 }
41
46
47
49 {
51
52 output["metadata"]["data_variant_id"] = GetDataVariantId();
53
54 output["attributes"]["flying_speed"] = GetAttributeFlyingSpeedValue();
55#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
56 output["attributes"]["attack_damage"] = GetAttributeAttackDamageValue();
57#endif
58
59 return output;
60 }
61
62
64 {
65 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_variant_id"));
66 }
67
68
69 void ParrotEntity::SetDataVariantId(const int data_variant_id)
70 {
71 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_variant_id"), data_variant_id);
72 }
73
74
76 {
77 std::shared_lock<std::shared_mutex> lock(entity_mutex);
79 }
80
81#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
83 {
84 std::shared_lock<std::shared_mutex> lock(entity_mutex);
86 }
87#endif
88
90 {
91 return 0.5;
92 }
93
95 {
96 return 0.9;
97 }
98
99}
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
std::map< EntityAttribute::Type, EntityAttribute > attributes
virtual double GetWidthImpl() const override
static constexpr int hierarchy_metadata_count
static constexpr int metadata_count
virtual double GetHeightImpl() const override
virtual EntityType GetType() const override
double GetAttributeFlyingSpeedValue() const
double GetAttributeAttackDamageValue() const
virtual ProtocolCraft::Json::Value Serialize() const override
virtual std::string GetName() const override
void SetDataVariantId(const int data_variant_id)
static std::string GetClassName()
static EntityType GetClassType()
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