Botcraft 1.21.4
Loading...
Searching...
No Matches
ZoglinEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
3
4#include <mutex>
5
6namespace Botcraft
7{
8 const std::array<std::string, ZoglinEntity::metadata_count> ZoglinEntity::metadata_names{ {
9 "data_baby_id",
10 } };
11
24
29
30
31 std::string ZoglinEntity::GetName() const
32 {
33 return "zoglin";
34 }
35
40
41
43 {
44 return "zoglin";
45 }
46
51
52
54 {
56
57 output["metadata"]["data_baby_id"] = GetDataBabyId();
58
59 return output;
60 }
61
62
63 void ZoglinEntity::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_baby_id"));
80 }
81
82
83 void ZoglinEntity::SetDataBabyId(const bool data_baby_id)
84 {
85 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
86 metadata["data_baby_id"] = data_baby_id;
87 }
88
89
91 {
92 return 1.3964844;
93 }
94
96 {
97 return 1.4;
98 }
99
100}
101#endif
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
std::map< EntityAttribute::Type, EntityAttribute > attributes
virtual ProtocolCraft::Json::Value Serialize() const override
virtual double GetWidthImpl() const override
void SetDataBabyId(const bool data_baby_id)
static const std::array< std::string, metadata_count > metadata_names
virtual double GetHeightImpl() const override
virtual void SetMetadataValue(const int index, const std::any &value) override
static std::string GetClassName()
virtual std::string GetName() const override
virtual EntityType GetType() const override
static constexpr int hierarchy_metadata_count
static constexpr int metadata_count
virtual ProtocolCraft::Json::Value Serialize() const override
static EntityType GetClassType()
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45