Botcraft 26.3
Loading...
Searching...
No Matches
FishingHookEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
10#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
11 SetDataBiting(false);
12#endif
13 }
14
19
20
21 std::string FishingHookEntity::GetName() const
22 {
23 return "fishing_bobber";
24 }
25
30
31
33 {
34 return "fishing_bobber";
35 }
36
41
43 {
44#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
46#else
48#endif
49
50 output["metadata"]["data_hooked_entity"] = GetDataHookedEntity();
51#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
52 output["metadata"]["data_biting"] = GetDataBiting();
53#endif
54
55 return output;
56 }
57
58
60 {
61 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_hooked_entity"));
62 }
63
64#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
66 {
67 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_biting"));
68 }
69#endif
70
71
72 void FishingHookEntity::SetDataHookedEntity(const int data_hooked_entity)
73 {
74 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_hooked_entity"), data_hooked_entity);
75 }
76
77#if PROTOCOL_VERSION > 578 /* > 1.15.2 */
78 void FishingHookEntity::SetDataBiting(const bool data_biting)
79 {
80 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_biting"), data_biting);
81 }
82#endif
83
84
86 {
87 return 0.25;
88 }
89
91 {
92 return 0.25;
93 }
94
95}
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
virtual ProtocolCraft::Json::Value Serialize() const
Definition Entity.cpp:1246
std::vector< std::any > metadata
Definition Entity.hpp:335
virtual std::string GetName() const override
void SetDataBiting(const bool data_biting)
virtual ProtocolCraft::Json::Value Serialize() const override
virtual EntityType GetType() const override
static constexpr int hierarchy_metadata_count
virtual double GetWidthImpl() const override
static std::string GetClassName()
static constexpr int metadata_count
virtual double GetHeightImpl() const override
void SetDataHookedEntity(const int data_hooked_entity)
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