Botcraft 26.3
Loading...
Searching...
No Matches
CamelEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
3
4namespace Botcraft
5{
7 {
8 // Initialize all metadata with default values
10 SetDash(true);
11#if PROTOCOL_VERSION < 762 /* < 1.19.4 */
13#else
15#endif
16
17 // Initialize all attributes with default values
20#if PROTOCOL_VERSION < 766 /* < 1.20.5 */
21 attributes.insert({ EntityAttribute::Type::HorseJumpStrength, EntityAttribute(EntityAttribute::Type::HorseJumpStrength, 0.42) });
22#else
25#endif
26 }
27
32
33
34 std::string CamelEntity::GetName() const
35 {
36 return "camel";
37 }
38
43
44
46 {
47 return "camel";
48 }
49
54
55
57 {
59
60 output["metadata"]["dash"] = GetDash();
61 output["metadata"]["last_pose_change_tick"] = GetLastPoseChangeTick();
62
63 return output;
64 }
65
66
68 {
69 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("dash"));
70 }
71
73 {
74 return GetMetadata<long long int>(BOTCRAFT_ENTITY_METADATA_INDEX("last_pose_change_tick"));
75 }
76
77
78 void CamelEntity::SetDash(const bool dash)
79 {
81 }
82
83 void CamelEntity::SetLastPoseChangeTick(const long long int last_pose_change_tick)
84 {
85 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("last_pose_change_tick"), last_pose_change_tick);
86 }
87
88
90 {
91 return 1.7;
92 }
93
95 {
96 return 2.375;
97 }
98
99}
100#endif
virtual ProtocolCraft::Json::Value Serialize() const override
virtual EntityType GetType() const override
virtual double GetWidthImpl() const override
virtual double GetHeightImpl() const override
static std::string GetClassName()
virtual std::string GetName() const override
static constexpr int hierarchy_metadata_count
void SetDash(const bool dash)
long long int GetLastPoseChangeTick() const
void SetLastPoseChangeTick(const long long int last_pose_change_tick)
virtual ProtocolCraft::Json::Value Serialize() const override
static EntityType GetClassType()
static constexpr int metadata_count
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
std::vector< std::any > metadata
Definition Entity.hpp:335
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