Botcraft 1.21.4
Loading...
Searching...
No Matches
WitherSkullEntity.cpp
Go to the documentation of this file.
2
3#include <mutex>
4
5namespace Botcraft
6{
7 const std::array<std::string, WitherSkullEntity::metadata_count> WitherSkullEntity::metadata_names{ {
8 "data_dangerous",
9 } };
10
12 {
13 // Initialize all metadata with default values
14 SetDataDangerous(false);
15 }
16
21
22
23 std::string WitherSkullEntity::GetName() const
24 {
25 return "wither_skull";
26 }
27
32
33
35 {
36 return "wither_skull";
37 }
38
43
44
46 {
48
49 output["metadata"]["data_dangerous"] = GetDataDangerous();
50
51 return output;
52 }
53
54
55 void WitherSkullEntity::SetMetadataValue(const int index, const std::any& value)
56 {
57 if (index < hierarchy_metadata_count)
58 {
60 }
62 {
63 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
65 }
66 }
67
69 {
70 std::shared_lock<std::shared_mutex> lock(entity_mutex);
71 return std::any_cast<bool>(metadata.at("data_dangerous"));
72 }
73
74
75 void WitherSkullEntity::SetDataDangerous(const bool data_dangerous)
76 {
77 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
78 metadata["data_dangerous"] = data_dangerous;
79 }
80
81
83 {
84 return 0.3125;
85 }
86
88 {
89 return 0.3125;
90 }
91
92}
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
static const std::array< std::string, metadata_count > metadata_names
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int hierarchy_metadata_count
static std::string GetClassName()
virtual double GetHeightImpl() const override
virtual std::string GetName() const override
virtual double GetWidthImpl() const override
void SetDataDangerous(const bool data_dangerous)
virtual EntityType GetType() const override
static constexpr int metadata_count
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45