Botcraft 26.3
Loading...
Searching...
No Matches
AvatarEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
3
4namespace Botcraft
5{
7 {
8 // Initialize all metadata with default values
12 }
13
18
20 {
21 return true;
22 }
23
24
25
27 {
29
30 output["metadata"]["data_player_main_hand"] = GetDataPlayerMainHand();
31 output["metadata"]["data_player_mode_customisation"] = GetDataPlayerModeCustomisation();
32
33 return output;
34 }
35
36
37#if PROTOCOL_VERSION < 774 /* < 1.21.11 */
39 {
40 return GetMetadata<char>(BOTCRAFT_ENTITY_METADATA_INDEX("data_player_main_hand"));
41 }
42#else
44 {
45 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_player_main_hand"));
46 }
47#endif
48
50 {
51 return GetMetadata<char>(BOTCRAFT_ENTITY_METADATA_INDEX("data_player_mode_customisation"));
52 }
53
54
55#if PROTOCOL_VERSION < 774 /* < 1.21.11 */
56 void AvatarEntity::SetDataPlayerMainHand(const char data_player_main_hand)
57 {
58 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_player_main_hand"), data_player_main_hand);
59 }
60#else
61 void AvatarEntity::SetDataPlayerMainHand(const int data_player_main_hand)
62 {
63 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_player_main_hand"), data_player_main_hand);
64 }
65#endif
66
67 void AvatarEntity::SetDataPlayerModeCustomisation(const char data_player_mode_customisation)
68 {
69 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_player_mode_customisation"), data_player_mode_customisation);
70 }
71
72}
73#endif
static constexpr int metadata_count
virtual ProtocolCraft::Json::Value Serialize() const override
char GetDataPlayerModeCustomisation() const
static constexpr int hierarchy_metadata_count
void SetDataPlayerModeCustomisation(const char data_player_mode_customisation)
int GetDataPlayerMainHand() const
virtual bool IsAvatar() const override
void SetDataPlayerMainHand(const int data_player_main_hand)
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
std::vector< std::any > metadata
Definition Entity.hpp:335
virtual ProtocolCraft::Json::Value Serialize() 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