Botcraft 1.21.11
Loading...
Searching...
No Matches
AbstractNautilusEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
3
4#include <mutex>
5
6namespace Botcraft
7{
8 const std::array<std::string, AbstractNautilusEntity::metadata_count> AbstractNautilusEntity::metadata_names{ {
9 "data_dash",
10 } };
11
23
28
30 {
31 return true;
32 }
33
34
36 {
38
39 output["metadata"]["data_dash"] = GetDataDash();
40
41 output["attributes"]["attack_damage"] = GetAttributeAttackDamageValue();
42
43 return output;
44 }
45
46
47 void AbstractNautilusEntity::SetMetadataValue(const int index, const std::any& value)
48 {
49 if (index < hierarchy_metadata_count)
50 {
52 }
54 {
55 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
57 }
58 }
59
61 {
62 std::shared_lock<std::shared_mutex> lock(entity_mutex);
63 return std::any_cast<bool>(metadata.at("data_dash"));
64 }
65
66
67 void AbstractNautilusEntity::SetDataDash(const bool data_dash)
68 {
69 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
70 metadata["data_dash"] = data_dash;
71 }
72
73
75 {
76 std::shared_lock<std::shared_mutex> lock(entity_mutex);
78 }
79
80}
81#endif
virtual ProtocolCraft::Json::Value Serialize() const override
virtual bool IsAbstractNautilus() const override
static const std::array< std::string, metadata_count > metadata_names
virtual void SetMetadataValue(const int index, const std::any &value) override
std::shared_mutex entity_mutex
Definition Entity.hpp:267
std::map< std::string, std::any > metadata
Definition Entity.hpp:282
std::map< EntityAttribute::Type, EntityAttribute > attributes
virtual void SetMetadataValue(const int index, const std::any &value) 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