Botcraft 1.21.4
Loading...
Searching...
No Matches
HoglinEntity.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, HoglinEntity::metadata_count> HoglinEntity::metadata_names{ {
9 "data_immune_to_zombification",
10 } };
11
24
29
30
31 std::string HoglinEntity::GetName() const
32 {
33 return "hoglin";
34 }
35
40
41
43 {
44 return "hoglin";
45 }
46
51
52
54 {
56
57 output["metadata"]["data_immune_to_zombification"] = GetDataImmuneToZombification();
58
59 output["attributes"]["attack_damage"] = GetAttributeAttackDamageValue();
60
61 return output;
62 }
63
64
65 void HoglinEntity::SetMetadataValue(const int index, const std::any& value)
66 {
67 if (index < hierarchy_metadata_count)
68 {
70 }
72 {
73 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
75 }
76 }
77
79 {
80 std::shared_lock<std::shared_mutex> lock(entity_mutex);
81 return std::any_cast<bool>(metadata.at("data_immune_to_zombification"));
82 }
83
84
85 void HoglinEntity::SetDataImmuneToZombification(const bool data_immune_to_zombification)
86 {
87 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
88 metadata["data_immune_to_zombification"] = data_immune_to_zombification;
89 }
90
91
93 {
94 std::shared_lock<std::shared_mutex> lock(entity_mutex);
96 }
97
98
100 {
101 return 1.3964844;
102 }
103
105 {
106 return 1.4;
107 }
108
109}
110#endif
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
virtual std::string GetName() const override
virtual void SetMetadataValue(const int index, const std::any &value) override
void SetDataImmuneToZombification(const bool data_immune_to_zombification)
static EntityType GetClassType()
static std::string GetClassName()
virtual double GetWidthImpl() const override
virtual ProtocolCraft::Json::Value Serialize() const override
virtual double GetHeightImpl() const override
static constexpr int metadata_count
virtual EntityType GetType() const override
double GetAttributeAttackDamageValue() const
bool GetDataImmuneToZombification() const
static const std::array< std::string, metadata_count > metadata_names
static constexpr int hierarchy_metadata_count
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