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