Botcraft 26.3
Loading...
Searching...
No Matches
SnifferEntity.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
3
4namespace Botcraft
5{
7 {
8 // Initialize all metadata with default values
10 SetDataState(0);
12
13 // Initialize all attributes with default values
16 }
17
22
23
24 std::string SnifferEntity::GetName() const
25 {
26 return "sniffer";
27 }
28
33
34
36 {
37 return "sniffer";
38 }
39
44
45
46
48 {
50
51 output["metadata"]["data_state"] = GetDataState();
52 output["metadata"]["data_drop_seed_at_tick"] = GetDataDropSeedAtTick();
53
54 return output;
55 }
56
57
59 {
60 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_state"));
61 }
62
64 {
65 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_drop_seed_at_tick"));
66 }
67
68
69 void SnifferEntity::SetDataState(const int data_state)
70 {
71 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_state"), data_state);
72 }
73
74 void SnifferEntity::SetDataDropSeedAtTick(const int data_drop_seed_at_tick)
75 {
76 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_drop_seed_at_tick"), data_drop_seed_at_tick);
77 }
78
79
81 {
82 return 1.9;
83 }
84
86 {
87 return 1.75;
88 }
89
90}
91#endif
virtual ProtocolCraft::Json::Value Serialize() const override
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
std::vector< std::any > metadata
Definition Entity.hpp:335
std::map< EntityAttribute::Type, EntityAttribute > attributes
static std::string GetClassName()
virtual std::string GetName() const override
virtual double GetHeightImpl() const override
static constexpr int hierarchy_metadata_count
virtual EntityType GetType() const override
void SetDataState(const int data_state)
int GetDataDropSeedAtTick() const
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int metadata_count
virtual double GetWidthImpl() const override
static EntityType GetClassType()
void SetDataDropSeedAtTick(const int data_drop_seed_at_tick)
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45
#define BOTCRAFT_ENTITY_METADATA_INDEX(name)
Definition Entity.hpp:347