Botcraft 1.21.10
Loading...
Searching...
No Matches
CopperGolemEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
3
4#include <mutex>
5
6namespace Botcraft
7{
8 const std::array<std::string, CopperGolemEntity::metadata_count> CopperGolemEntity::metadata_names{ {
9 "copper_golem_state",
10 } };
11
22
27
28
29 std::string CopperGolemEntity::GetName() const
30 {
31 return "copper_golem";
32 }
33
38
39
41 {
42 return "copper_golem";
43 }
44
49
50
52 {
54
55 output["metadata"]["copper_golem_state"] = GetCopperGolemState();
56
57 return output;
58 }
59
60
61 void CopperGolemEntity::SetMetadataValue(const int index, const std::any& value)
62 {
63 if (index < hierarchy_metadata_count)
64 {
66 }
68 {
69 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
71 }
72 }
73
75 {
76 std::shared_lock<std::shared_mutex> lock(entity_mutex);
77 return std::any_cast<int>(metadata.at("copper_golem_state"));
78 }
79
80
81 void CopperGolemEntity::SetCopperGolemState(const int copper_golem_state)
82 {
83 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
84 metadata["copper_golem_state"] = copper_golem_state;
85 }
86
87
89 {
90 return 0.49;
91 }
92
94 {
95 return 0.98;
96 }
97
98}
99#endif
static constexpr int metadata_count
virtual void SetMetadataValue(const int index, const std::any &value) override
virtual ProtocolCraft::Json::Value Serialize() const override
static const std::array< std::string, metadata_count > metadata_names
virtual std::string GetName() const override
static std::string GetClassName()
virtual EntityType GetType() const override
void SetCopperGolemState(const int copper_golem_state)
virtual double GetWidthImpl() const override
static constexpr int hierarchy_metadata_count
virtual double GetHeightImpl() const override
virtual ProtocolCraft::Json::Value Serialize() const
Definition Entity.cpp:1189
virtual void SetMetadataValue(const int index, const std::any &value)
Definition Entity.cpp:716
std::shared_mutex entity_mutex
Definition Entity.hpp:264
std::map< std::string, std::any > metadata
Definition Entity.hpp:279
std::map< EntityAttribute::Type, EntityAttribute > attributes
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45