Botcraft 26.3
Loading...
Searching...
No Matches
ShulkerEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
10#if PROTOCOL_VERSION < 755 /* < 1.17 */
11 SetDataAttachPosId(std::optional<Position>());
12#endif
15
16 // Initialize all attributes with default values
18 }
19
24
25
26 std::string ShulkerEntity::GetName() const
27 {
28 return "shulker";
29 }
30
35
36
38 {
39 return "shulker";
40 }
41
46
47
49 {
51
52 output["metadata"]["data_attach_face_id"] = static_cast<int>(GetDataAttachFaceId());
53#if PROTOCOL_VERSION < 755 /* < 1.17 */
54 output["metadata"]["data_attach_pos_id"] = GetDataAttachPosId() ? GetDataAttachPosId().value().Serialize() : ProtocolCraft::Json::Value();
55#endif
56 output["metadata"]["data_peek_id"] = GetDataPeekId();
57 output["metadata"]["data_color_id"] = GetDataColorId();
58
59 return output;
60 }
61
62
64 {
65 return GetMetadata<Direction>(BOTCRAFT_ENTITY_METADATA_INDEX("data_attach_face_id"));
66 }
67
68#if PROTOCOL_VERSION < 755 /* < 1.17 */
69 std::optional<Position> ShulkerEntity::GetDataAttachPosId() const
70 {
71 return GetMetadata<std::optional<Position>>(BOTCRAFT_ENTITY_METADATA_INDEX("data_attach_pos_id"));
72 }
73#endif
74
76 {
77 return GetMetadata<char>(BOTCRAFT_ENTITY_METADATA_INDEX("data_peek_id"));
78 }
79
81 {
82 return GetMetadata<char>(BOTCRAFT_ENTITY_METADATA_INDEX("data_color_id"));
83 }
84
85
86 void ShulkerEntity::SetDataAttachFaceId(const Direction data_attach_face_id)
87 {
88 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_attach_face_id"), data_attach_face_id);
89 }
90
91#if PROTOCOL_VERSION < 755 /* < 1.17 */
92 void ShulkerEntity::SetDataAttachPosId(const std::optional<Position>& data_attach_pos_id)
93 {
94 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_attach_pos_id"), data_attach_pos_id);
95 }
96#endif
97
98 void ShulkerEntity::SetDataPeekId(const char data_peek_id)
99 {
100 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_peek_id"), data_peek_id);
101 }
102
103 void ShulkerEntity::SetDataColorId(const char data_color_id)
104 {
105 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_color_id"), data_color_id);
106 }
107
108
110 {
111 return 1.0;
112 }
113
115 {
116 return 1.0;
117 }
118
119}
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
std::map< EntityAttribute::Type, EntityAttribute > attributes
void SetDataPeekId(const char data_peek_id)
virtual std::string GetName() const override
static EntityType GetClassType()
Direction GetDataAttachFaceId() const
virtual double GetHeightImpl() const override
virtual EntityType GetType() const override
static constexpr int metadata_count
static std::string GetClassName()
static constexpr int hierarchy_metadata_count
virtual double GetWidthImpl() const override
void SetDataAttachFaceId(const Direction data_attach_face_id)
virtual ProtocolCraft::Json::Value Serialize() const override
void SetDataColorId(const char data_color_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