Botcraft 26.3
Loading...
Searching...
No Matches
AgeableMobEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
9 SetDataBabyId(false);
10#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
11 SetAgeLocked(false);
12#endif
13 }
14
19
21 {
22 return true;
23 }
24
25
27 {
29
30 output["metadata"]["data_baby_id"] = GetDataBabyId();
31#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
32 output["metadata"]["age_locked"] = GetAgeLocked();
33#endif
34
35 return output;
36 }
37
38
40 {
41 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_baby_id"));
42 }
43
44#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
46 {
47 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("age_locked"));
48 }
49#endif
50
51
52 void AgeableMobEntity::SetDataBabyId(const bool data_baby_id)
53 {
54 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_baby_id"), data_baby_id);
55 }
56
57#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
58 void AgeableMobEntity::SetAgeLocked(const bool age_locked)
59 {
60 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("age_locked"), age_locked);
61 }
62#endif
63
64}
void SetAgeLocked(const bool age_locked)
static constexpr int metadata_count
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int hierarchy_metadata_count
virtual bool IsAgeableMob() const override
void SetDataBabyId(const bool data_baby_id)
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
virtual ProtocolCraft::Json::Value Serialize() const
Definition Entity.cpp:1246
std::vector< std::any > metadata
Definition Entity.hpp:335
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