Botcraft 26.3
Loading...
Searching...
No Matches
GoatEntity.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#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
14#endif
15
16 // Initialize all attributes with default values
20 }
21
26
27
28 std::string GoatEntity::GetName() const
29 {
30 return "goat";
31 }
32
34 {
35 return EntityType::Goat;
36 }
37
38
40 {
41 return "goat";
42 }
43
48
49
51 {
53
54 output["metadata"]["data_is_screaming_goat"] = GetDataIsScreamingGoat();
55#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
56 output["metadata"]["data_has_left_horn"] = GetDataHasLeftHorn();
57 output["metadata"]["data_has_right_horn"] = GetDataHasRightHorn();
58#endif
59
60 output["attributes"]["attack_damage"] = GetAttributeAttackDamageValue();
61
62 return output;
63 }
64
65
67 {
68 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_is_screaming_goat"));
69 }
70
71#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
73 {
74 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_has_left_horn"));
75 }
76
78 {
79 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_has_right_horn"));
80 }
81#endif
82
83
84 void GoatEntity::SetDataIsScreamingGoat(const bool data_is_screaming_goat)
85 {
86 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_is_screaming_goat"), data_is_screaming_goat);
87 }
88
89#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
90 void GoatEntity::SetDataHasLeftHorn(const bool data_has_left_horn)
91 {
92 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_has_left_horn"), data_has_left_horn);
93 }
94
95 void GoatEntity::SetDataHasRightHorn(const bool data_has_right_horn)
96 {
97 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_has_right_horn"), data_has_right_horn);
98 }
99#endif
100
101
103 {
104 std::shared_lock<std::shared_mutex> lock(entity_mutex);
106 }
107
108
110 {
111 return 0.9;
112 }
113
115 {
116 return 1.3;
117 }
118
119}
120#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
void SetDataIsScreamingGoat(const bool data_is_screaming_goat)
virtual EntityType GetType() const override
static EntityType GetClassType()
static constexpr int metadata_count
static constexpr int hierarchy_metadata_count
bool GetDataIsScreamingGoat() const
virtual double GetWidthImpl() const override
void SetDataHasRightHorn(const bool data_has_right_horn)
static std::string GetClassName()
virtual std::string GetName() const override
virtual double GetHeightImpl() const override
bool GetDataHasRightHorn() const
void SetDataHasLeftHorn(const bool data_has_left_horn)
double GetAttributeAttackDamageValue() const
bool GetDataHasLeftHorn() const
virtual ProtocolCraft::Json::Value Serialize() const override
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