Botcraft 26.3
Loading...
Searching...
No Matches
ZombieEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
9 SetDataBabyId(false);
11#if PROTOCOL_VERSION < 405 /* < 1.14 */
12 SetDataAreHandsUp(false);
13#endif
14#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
16#endif
17
18 // Initialize all attributes with default values
24 }
25
30
31
32 std::string ZombieEntity::GetName() const
33 {
34 return "zombie";
35 }
36
41
42
44 {
45 return "zombie";
46 }
47
52
53
55 {
57
58 output["metadata"]["data_baby_id"] = GetDataBabyId();
59 output["metadata"]["data_special_type_id"] = GetDataSpecialTypeId();
60#if PROTOCOL_VERSION < 405 /* < 1.14 */
61 output["metadata"]["data_are_hands_up"] = GetDataAreHandsUp();
62#endif
63#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
64 output["metadata"]["data_drowned_conversion_id"] = GetDataDrownedConversionId();
65#endif
66
67 output["attributes"]["spawn_reinforcements"] = GetAttributeSpawnReinforcementsChanceValue();
68
69 return output;
70 }
71
72
74 {
75 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_baby_id"));
76 }
77
79 {
80 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_special_type_id"));
81 }
82
83#if PROTOCOL_VERSION < 405 /* < 1.14 */
84 bool ZombieEntity::GetDataAreHandsUp() const
85 {
86 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_are_hands_up"));
87 }
88#endif
89
90#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
92 {
93 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_drowned_conversion_id"));
94 }
95#endif
96
97
98 void ZombieEntity::SetDataBabyId(const bool data_baby_id)
99 {
100 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_baby_id"), data_baby_id);
101 }
102
103 void ZombieEntity::SetDataSpecialTypeId(const int data_special_type_id)
104 {
105 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_special_type_id"), data_special_type_id);
106 }
107
108#if PROTOCOL_VERSION < 405 /* < 1.14 */
109 void ZombieEntity::SetDataAreHandsUp(const bool data_are_hands_up)
110 {
111 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_are_hands_up"), data_are_hands_up);
112 }
113#endif
114
115#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
116 void ZombieEntity::SetDataDrownedConversionId(const bool data_drowned_conversion_id)
117 {
118 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_drowned_conversion_id"), data_drowned_conversion_id);
119 }
120#endif
121
122
124 {
125 std::shared_lock<std::shared_mutex> lock(entity_mutex);
127 }
128
129
131 {
132 return 0.6;
133 }
134
136 {
137 return 1.95;
138 }
139
140}
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 ProtocolCraft::Json::Value Serialize() const override
static constexpr int hierarchy_metadata_count
bool GetDataDrownedConversionId() const
static EntityType GetClassType()
static std::string GetClassName()
virtual ProtocolCraft::Json::Value Serialize() const override
virtual double GetWidthImpl() const override
int GetDataSpecialTypeId() const
virtual EntityType GetType() const override
virtual std::string GetName() const override
virtual double GetHeightImpl() const override
void SetDataDrownedConversionId(const bool data_drowned_conversion_id)
double GetAttributeSpawnReinforcementsChanceValue() const
static constexpr int metadata_count
void SetDataSpecialTypeId(const int data_special_type_id)
void SetDataBabyId(const bool data_baby_id)
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