Botcraft 1.21.4
Loading...
Searching...
No Matches
PolarBearEntity.cpp
Go to the documentation of this file.
2
3#include <mutex>
4
5namespace Botcraft
6{
7 const std::array<std::string, PolarBearEntity::metadata_count> PolarBearEntity::metadata_names{ {
8 "data_standing_id",
9 } };
10
22
27
28
29 std::string PolarBearEntity::GetName() const
30 {
31 return "polar_bear";
32 }
33
38
39
41 {
42 return "polar_bear";
43 }
44
49
50
52 {
54
55 output["metadata"]["data_standing_id"] = GetDataStandingId();
56
57 output["attributes"]["attack_damage"] = GetAttributeAttackDamageValue();
58
59 return output;
60 }
61
62
63 void PolarBearEntity::SetMetadataValue(const int index, const std::any& value)
64 {
65 if (index < hierarchy_metadata_count)
66 {
68 }
70 {
71 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
73 }
74 }
75
77 {
78 std::shared_lock<std::shared_mutex> lock(entity_mutex);
79 return std::any_cast<bool>(metadata.at("data_standing_id"));
80 }
81
82
83 void PolarBearEntity::SetDataStandingId(const bool data_standing_id)
84 {
85 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
86 metadata["data_standing_id"] = data_standing_id;
87 }
88
89
91 {
92 std::shared_lock<std::shared_mutex> lock(entity_mutex);
94 }
95
96
98 {
99#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
100 return 1.4;
101#else
102 return 1.3;
103#endif
104 }
105
107 {
108 return 1.4;
109 }
110
111}
virtual void SetMetadataValue(const int index, const std::any &value) override
virtual ProtocolCraft::Json::Value Serialize() const override
std::shared_mutex entity_mutex
Definition Entity.hpp:253
std::map< std::string, std::any > metadata
Definition Entity.hpp:268
std::map< EntityAttribute::Type, EntityAttribute > attributes
static std::string GetClassName()
void SetDataStandingId(const bool data_standing_id)
virtual std::string GetName() const override
virtual double GetWidthImpl() const override
virtual ProtocolCraft::Json::Value Serialize() const override
double GetAttributeAttackDamageValue() const
static constexpr int metadata_count
virtual double GetHeightImpl() const override
static const std::array< std::string, metadata_count > metadata_names
virtual EntityType GetType() const override
static EntityType GetClassType()
static constexpr int hierarchy_metadata_count
virtual void SetMetadataValue(const int index, const std::any &value) override
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45