Botcraft 26.3
Loading...
Searching...
No Matches
BoatEntity.hpp
Go to the documentation of this file.
1#pragma once
2
3#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
5#elif PROTOCOL_VERSION < 768 /* < 1.21.2 */
7#else
9#endif
10
11namespace Botcraft
12{
13#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
14 class BoatEntity : public Entity
15#elif PROTOCOL_VERSION < 768 /* < 1.21.2 */
16 class BoatEntity : public VehicleEntity
17#else
19#endif
20 {
21#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
22 private:
23 static constexpr std::array metadata_names{
24#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
25 std::string_view("data_id_hurt"),
26 std::string_view("data_id_hurtdir"),
27 std::string_view("data_id_damage"),
28#endif
29 std::string_view("data_id_type"),
30 std::string_view("data_id_paddle_left"),
31 std::string_view("data_id_paddle_right"),
32#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
33 std::string_view("data_id_bubble_time"),
34#endif
35 };
36#endif
37 protected:
38#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
39 static constexpr int metadata_count = static_cast<int>(metadata_names.size());
40#else
41 static constexpr int metadata_count = 0;
42#endif
43#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
45#elif PROTOCOL_VERSION < 768 /* < 1.21.2 */
47#else
49#endif
50
51 public:
52#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
53 BoatEntity();
54#else
56#endif
57 virtual ~BoatEntity();
58
59 // Object related stuff
60 virtual std::string GetName() const override;
61 virtual EntityType GetType() const override;
62
63 // Static stuff, for easier comparison
64 static std::string GetClassName();
65#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
66 static EntityType GetClassType();
67#else
68 virtual bool IsBoat() const override;
69#endif
70
71
72 virtual ProtocolCraft::Json::Value Serialize() const override;
73
74#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
75 // Metadata stuff
76#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
77 int GetDataIdHurt() const;
78 int GetDataIdHurtdir() const;
79 float GetDataIdDamage() const;
80#endif
81 int GetDataIdType() const;
82 bool GetDataIdPaddleLeft() const;
83 bool GetDataIdPaddleRight() const;
84#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
85 int GetDataIdBubbleTime() const;
86#endif
87
88#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
89 void SetDataIdHurt(const int data_id_hurt);
90 void SetDataIdHurtdir(const int data_id_hurtdir);
91 void SetDataIdDamage(const float data_id_damage);
92#endif
93 void SetDataIdType(const int data_id_type);
94 void SetDataIdPaddleLeft(const bool data_id_paddle_left);
95 void SetDataIdPaddleRight(const bool data_id_paddle_right);
96#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
97 void SetDataIdBubbleTime(const int data_id_bubble_time);
98#endif
99#endif
100
101#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
102 protected:
104#endif
105
106 protected:
107 virtual double GetWidthImpl() const override;
108 virtual double GetHeightImpl() const override;
109
110 };
111}
void SetDataIdPaddleRight(const bool data_id_paddle_right)
static constexpr std::array metadata_names
static constexpr int metadata_count
void SetDataIdBubbleTime(const int data_id_bubble_time)
void SetDataIdPaddleLeft(const bool data_id_paddle_left)
static constexpr int hierarchy_metadata_count
virtual double GetWidthImpl() const override
virtual ProtocolCraft::Json::Value Serialize() const override
virtual EntityType GetType() const override
static std::string GetClassName()
virtual double GetHeightImpl() const override
const EntityType type
virtual bool IsBoat() const override
static constexpr int hierarchy_metadata_count
virtual std::string GetName() const override
static constexpr int metadata_count
static constexpr int hierarchy_metadata_count
Definition Entity.hpp:73
static constexpr int metadata_count
Definition Entity.hpp:72
void SetDataIdHurt(const int data_id_hurt)
static constexpr int metadata_count
void SetDataIdDamage(const float data_id_damage)
float GetDataIdDamage() const
static constexpr int hierarchy_metadata_count
void SetDataIdHurtdir(const int data_id_hurtdir)
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45