Botcraft 26.3
Loading...
Searching...
No Matches
HangingEntity.cpp
Go to the documentation of this file.
2
4
5namespace Botcraft
6{
8 {
9 // Initialize all metadata with default values
11#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
12 SetDataDirection(static_cast<int>(Direction::South));
13#endif
14
15 }
16
21
23 {
24 return true;
25 }
26
27
28#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
30 {
32
33 output["metadata"]["data_direction"] = GetDataDirection();
34
35 return output;
36 }
37
39 {
40 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_direction"));
41 }
42
43
44 void HangingEntity::SetDataDirection(const int data_direction)
45 {
46 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_direction"), data_direction);
47 }
48#endif
49
50}
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
virtual ProtocolCraft::Json::Value Serialize() const override
virtual bool IsHangingEntity() const override
static constexpr int hierarchy_metadata_count
void SetDataDirection(const int data_direction)
static constexpr int 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