Botcraft 26.3
Loading...
Searching...
No Matches
StriderEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
3
4namespace Botcraft
5{
7 {
8 // Initialize all metadata with default values
11 SetDataSuffocating(false);
12#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
13 SetDataSaddleId(false);
14#endif
15
16 // Initialize all attributes with default values
18#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
20#endif
21 }
22
27
28
29 std::string StriderEntity::GetName() const
30 {
31 return "strider";
32 }
33
38
39
41 {
42 return "strider";
43 }
44
49
50
52 {
54
55 output["metadata"]["data_boost_time"] = GetDataBoostTime();
56 output["metadata"]["data_suffocating"] = GetDataSuffocating();
57#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
58 output["metadata"]["data_saddle_id"] = GetDataSaddleId();
59#endif
60
61 return output;
62 }
63
64
66 {
67 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_boost_time"));
68 }
69
71 {
72 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_suffocating"));
73 }
74
75#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
76 bool StriderEntity::GetDataSaddleId() const
77 {
78 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_saddle_id"));
79 }
80#endif
81
82
83 void StriderEntity::SetDataBoostTime(const int data_boost_time)
84 {
85 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_boost_time"), data_boost_time);
86 }
87
88 void StriderEntity::SetDataSuffocating(const bool data_suffocating)
89 {
90 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_suffocating"), data_suffocating);
91 }
92
93#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
94 void StriderEntity::SetDataSaddleId(const bool data_saddle_id)
95 {
96 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_saddle_id"), data_saddle_id);
97 }
98#endif
99
100
102 {
103 return 0.9;
104 }
105
107 {
108 return 1.7;
109 }
110
111}
112#endif
virtual ProtocolCraft::Json::Value Serialize() const override
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
static EntityType GetClassType()
virtual EntityType GetType() const override
bool GetDataSuffocating() const
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int metadata_count
static constexpr int hierarchy_metadata_count
void SetDataBoostTime(const int data_boost_time)
static std::string GetClassName()
virtual double GetHeightImpl() const override
virtual double GetWidthImpl() const override
void SetDataSuffocating(const bool data_suffocating)
virtual std::string GetName() const override
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