Botcraft 1.21.4
Loading...
Searching...
No Matches
PillagerEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
3
4#include <mutex>
5
6namespace Botcraft
7{
8 const std::array<std::string, PillagerEntity::metadata_count> PillagerEntity::metadata_names{ {
9 "is_charging_crossbow",
10 } };
11
23
28
29
30 std::string PillagerEntity::GetName() const
31 {
32 return "pillager";
33 }
34
39
40
42 {
43 return "pillager";
44 }
45
50
51
53 {
55
56 output["metadata"]["is_charging_crossbow"] = GetIsChargingCrossbow();
57
58 return output;
59 }
60
61
62 void PillagerEntity::SetMetadataValue(const int index, const std::any& value)
63 {
64 if (index < hierarchy_metadata_count)
65 {
67 }
69 {
70 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
72 }
73 }
74
76 {
77 std::shared_lock<std::shared_mutex> lock(entity_mutex);
78 return std::any_cast<bool>(metadata.at("is_charging_crossbow"));
79 }
80
81
82 void PillagerEntity::SetIsChargingCrossbow(const bool is_charging_crossbow)
83 {
84 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
85 metadata["is_charging_crossbow"] = is_charging_crossbow;
86 }
87
88
90 {
91 return 0.6;
92 }
93
95 {
96 return 1.95;
97 }
98
99}
100#endif
virtual ProtocolCraft::Json::Value Serialize() const
Definition Entity.cpp:1095
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 double GetHeightImpl() const override
static constexpr int hierarchy_metadata_count
static const std::array< std::string, metadata_count > metadata_names
virtual EntityType GetType() const override
virtual std::string GetName() const override
virtual void SetMetadataValue(const int index, const std::any &value) override
static constexpr int metadata_count
static EntityType GetClassType()
static std::string GetClassName()
void SetIsChargingCrossbow(const bool is_charging_crossbow)
virtual double GetWidthImpl() const override
virtual ProtocolCraft::Json::Value Serialize() const override
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45