Botcraft 26.3
Loading...
Searching...
No Matches
RabbitEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
10
11 // Initialize all attributes with default values
14#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
16#endif
17 }
18
23
24
25 std::string RabbitEntity::GetName() const
26 {
27 return "rabbit";
28 }
29
34
35
37 {
38 return "rabbit";
39 }
40
45
46
48 {
50
51 output["metadata"]["data_type_id"] = GetDataTypeId();
52
53#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
54 output["attribute"]["attack_damage"] = GetAttributeAttackDamageValue();
55#endif
56
57 return output;
58 }
59
60
62 {
63 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_type_id"));
64 }
65
66
67 void RabbitEntity::SetDataTypeId(const int data_type_id)
68 {
69 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_type_id"), data_type_id);
70 }
71
72#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
74 {
75 std::shared_lock<std::shared_mutex> lock(entity_mutex);
77 }
78#endif
79
80
82 {
83#if PROTOCOL_VERSION < 775 /* < 26.1 */
84 return 0.4;
85#else
86 return 0.49;
87#endif
88 }
89
91 {
92#if PROTOCOL_VERSION < 775 /* < 26.1 */
93 return 0.5;
94#else
95 return 0.6;
96#endif
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
void SetDataTypeId(const int data_type_id)
virtual double GetHeightImpl() const override
static constexpr int metadata_count
virtual double GetWidthImpl() const override
virtual std::string GetName() const override
static EntityType GetClassType()
static std::string GetClassName()
double GetAttributeAttackDamageValue() const
virtual EntityType GetType() const override
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int hierarchy_metadata_count
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