Botcraft 1.21.4
Loading...
Searching...
No Matches
SkeletonEntity.cpp
Go to the documentation of this file.
2
3#include <mutex>
4
5namespace Botcraft
6{
7#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
8 const std::array<std::string, SkeletonEntity::metadata_count> SkeletonEntity::metadata_names{ {
9 "data_stray_conversion_id",
10 } };
11#endif
12
14 {
15#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
16 // Initialize all metadata with default values
18#endif
19 }
20
25
26
27 std::string SkeletonEntity::GetName() const
28 {
29 return "skeleton";
30 }
31
36
37
39 {
40 return "skeleton";
41 }
42
47
48
49#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
51 {
53
54 output["metadata"]["data_stray_conversion_id"] = GetDataStrayConversionId();
55
56 return output;
57 }
58
59
60 void SkeletonEntity::SetMetadataValue(const int index, const std::any& value)
61 {
62 if (index < hierarchy_metadata_count)
63 {
65 }
67 {
68 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
70 }
71 }
72
74 {
75 std::shared_lock<std::shared_mutex> lock(entity_mutex);
76 return std::any_cast<bool>(metadata.at("data_stray_conversion_id"));
77 }
78
79
80 void SkeletonEntity::SetDataStrayConversionId(const bool data_stray_conversion_id)
81 {
82 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
83 metadata["data_stray_conversion_id"] = data_stray_conversion_id;
84 }
85#endif
86
87
89 {
90 return 0.6;
91 }
92
94 {
95 return 1.99;
96 }
97
98}
virtual ProtocolCraft::Json::Value Serialize() const
Definition Entity.cpp:1095
virtual void SetMetadataValue(const int index, const std::any &value)
Definition Entity.cpp:622
std::shared_mutex entity_mutex
Definition Entity.hpp:253
std::map< std::string, std::any > metadata
Definition Entity.hpp:268
virtual void SetMetadataValue(const int index, const std::any &value) override
virtual ProtocolCraft::Json::Value Serialize() const override
static std::string GetClassName()
bool GetDataStrayConversionId() const
virtual double GetHeightImpl() const override
virtual EntityType GetType() const override
static constexpr int hierarchy_metadata_count
static const std::array< std::string, metadata_count > metadata_names
virtual std::string GetName() const override
virtual double GetWidthImpl() const override
static constexpr int metadata_count
void SetDataStrayConversionId(const bool data_stray_conversion_id)
static EntityType GetClassType()
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45