Botcraft 1.21.10
Loading...
Searching...
No Matches
PlayerEntity.hpp
Go to the documentation of this file.
1#pragma once
2
3#if PROTOCOL_VERSION < 773 /* < 1.21.9 */
6#else
8#endif
9
10namespace Botcraft
11{
12#if PROTOCOL_VERSION < 773 /* < 1.21.9 */
13 class PlayerEntity : public LivingEntity
14#else
16#endif
17 {
18 protected:
19#if PROTOCOL_VERSION < 773 /* < 1.21.9 */
20 static constexpr int metadata_count = 6;
21 static const std::array<std::string, metadata_count> metadata_names;
23#else
24 static constexpr int metadata_count = 4;
25 static const std::array<std::string, metadata_count> metadata_names;
27#endif
28
29 public:
31 virtual ~PlayerEntity();
32
33 // Object related stuff
34 /// @brief Get the name of this entity TYPE as a string. For player name see NetworkManager::GetMyName()
35 virtual std::string GetName() const override;
36 virtual EntityType GetType() const override;
37
38#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
39 using Entity::GetCollider; // Required as otherwise GetCollider(Pose) would be found and stop the search for a GetCollider match
40 AABB GetCollider(const Pose pose) const;
41 using Entity::GetHeight; // Required as otherwise GetHeight(Pose) would be found and stop the search for a GetHeight match
42 double GetHeight(const Pose pose) const;
43 using Entity::GetWidth; // Required as otherwise GetWidth(Pose) would be found and stop the search for a GetWidth match
44 double GetWidth(const Pose pose) const;
45#endif
46 double GetEyeHeight() const;
47
48 // Static stuff, for easier comparison
49 static std::string GetClassName();
50 static EntityType GetClassType();
51
52
53 virtual ProtocolCraft::Json::Value Serialize() const override;
54
55 // Metadata stuff
56 virtual void SetMetadataValue(const int index, const std::any& value) override;
57
58
59 float GetDataPlayerAbsorptionId() const;
60 int GetDataScoreId() const;
61#if PROTOCOL_VERSION < 773 /* < 1.21.9 */
63 char GetDataPlayerMainHand() const;
64 ProtocolCraft::NBT::Value GetDataShoulderLeft() const;
65 ProtocolCraft::NBT::Value GetDataShoulderRight() const;
66#else
67 const std::optional<int>& GetDataShoulderParrotLeft() const;
68 const std::optional<int>& GetDataShoulderParrotRight() const;
69#endif
70
71 void SetDataPlayerAbsorptionId(const float data_player_absorption_id);
72 void SetDataScoreId(const int data_score_id);
73#if PROTOCOL_VERSION < 773 /* < 1.21.9 */
74 void SetDataPlayerModeCustomisation(const char data_player_mode_customisation);
75 void SetDataPlayerMainHand(const char data_player_main_hand);
76 void SetDataShoulderLeft(const ProtocolCraft::NBT::Value& data_shoulder_left);
77 void SetDataShoulderRight(const ProtocolCraft::NBT::Value& data_shoulder_right);
78#else
79 void SetDataShoulderParrotLeft(const std::optional<int>& data_shoulder_parrot_left);
80 void SetDataShoulderParrotRight(const std::optional<int>& data_shoulder_parrot_right);
81#endif
82
83 virtual bool IsRemotePlayer() const override;
84
85 // Attribute stuff
86 double GetAttributeAttackDamageValue() const;
87 double GetAttributeAttackSpeedValue() const;
88 double GetAttributeLuckValue() const;
89#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
93#endif
94#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
99#endif
100#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
102#endif
103
104 protected:
105 virtual double GetEyeHeightImpl() const;
106 virtual double GetWidthImpl() const override;
107 virtual double GetHeightImpl() const override;
108#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
109 using Entity::GetColliderImpl; // Required as otherwise GetColliderImpl(Pose) would be found and stop the search for a GetColliderImpl match
110 AABB GetColliderImpl(const Pose pose) const;
111#endif
112#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
114#endif
115
116 };
117}
static constexpr int metadata_count
char GetDataPlayerModeCustomisation() const
static constexpr int hierarchy_metadata_count
void SetDataPlayerMainHand(const char data_player_main_hand)
void SetDataPlayerModeCustomisation(const char data_player_mode_customisation)
char GetDataPlayerMainHand() const
double GetHeight() const
Definition Entity.cpp:357
AABB GetCollider() const
Definition Entity.cpp:345
double GetWidth() const
Definition Entity.cpp:351
AABB GetColliderImpl() const
Definition Entity.cpp:2127
static constexpr int hierarchy_metadata_count
static constexpr int metadata_count
double GetAttributePlayerBlockBreakSpeedValue() const
virtual void SetMetadataValue(const int index, const std::any &value) override
double GetAttributeAttackSpeedValue() const
void SetDataPlayerAbsorptionId(const float data_player_absorption_id)
double GetHeight() const
Definition Entity.cpp:357
virtual double GetWidthImpl() const override
double GetAttributePlayerSweepingDamageRatioValue() const
static constexpr int hierarchy_metadata_count
void SetDataShoulderParrotLeft(const std::optional< int > &data_shoulder_parrot_left)
AABB GetCollider() const
Definition Entity.cpp:345
virtual double GetHeightImpl() const override
double GetWidth() const
Definition Entity.cpp:351
float GetDataPlayerAbsorptionId() const
void SetDataShoulderParrotRight(const std::optional< int > &data_shoulder_parrot_right)
virtual std::string GetName() const override
Get the name of this entity TYPE as a string. For player name see NetworkManager::GetMyName()
virtual EntityType GetType() const override
double GetAttributeLuckValue() const
double GetAttributePlayerSneakingSpeedValueImpl() const
const std::optional< int > & GetDataShoulderParrotRight() const
double GetAttributePlayerBlockInteractionRangeValue() const
virtual ProtocolCraft::Json::Value Serialize() const override
virtual bool IsRemotePlayer() const override
double GetAttributePlayerEntityInteractionRangeValue() const
static constexpr int metadata_count
AABB GetColliderImpl() const
Definition Entity.cpp:2127
static EntityType GetClassType()
void SetDataScoreId(const int data_score_id)
double GetAttributePlayerSubmergedMiningSpeedValue() const
static std::string GetClassName()
const std::optional< int > & GetDataShoulderParrotLeft() const
double GetEyeHeight() const
virtual double GetEyeHeightImpl() const
double GetAttributePlayerMiningEfficiencyValue() const
static const std::array< std::string, metadata_count > metadata_names
double GetAttributePlayerSneakingSpeedValue() const
double GetAttributeAttackDamageValue() const
double GetAttributeWaypointReceiveRangeValue() const
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45