Botcraft 1.21.4
Loading...
Searching...
No Matches
Botcraft::PlayerEntity Class Reference

#include <PlayerEntity.hpp>

Inheritance diagram for Botcraft::PlayerEntity:
Botcraft::LivingEntity Botcraft::Entity Botcraft::LocalPlayer

Public Member Functions

 PlayerEntity ()
 
virtual ~PlayerEntity ()
 
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
 
AABB GetCollider (const Pose pose) const
 
double GetHeight (const Pose pose) const
 
double GetWidth (const Pose pose) const
 
double GetEyeHeight () const
 
virtual ProtocolCraft::Json::Value Serialize () const override
 
virtual void SetMetadataValue (const int index, const std::any &value) override
 
float GetDataPlayerAbsorptionId () const
 
int GetDataScoreId () const
 
char GetDataPlayerModeCustomisation () const
 
char GetDataPlayerMainHand () const
 
ProtocolCraft::NBT::Value GetDataShoulderLeft () const
 
ProtocolCraft::NBT::Value GetDataShoulderRight () const
 
void SetDataPlayerAbsorptionId (const float data_player_absorption_id)
 
void SetDataScoreId (const int data_score_id)
 
void SetDataPlayerModeCustomisation (const char data_player_mode_customisation)
 
void SetDataPlayerMainHand (const char data_player_main_hand)
 
void SetDataShoulderLeft (const ProtocolCraft::NBT::Value &data_shoulder_left)
 
void SetDataShoulderRight (const ProtocolCraft::NBT::Value &data_shoulder_right)
 
virtual bool IsRemotePlayer () const override
 
double GetAttributeAttackDamageValue () const
 
double GetAttributeAttackSpeedValue () const
 
double GetAttributeLuckValue () const
 
double GetAttributePlayerBlockInteractionRangeValue () const
 
double GetAttributePlayerEntityInteractionRangeValue () const
 
double GetAttributePlayerBlockBreakSpeedValue () const
 
double GetAttributePlayerSubmergedMiningSpeedValue () const
 
double GetAttributePlayerSneakingSpeedValue () const
 
double GetAttributePlayerMiningEfficiencyValue () const
 
double GetAttributePlayerSweepingDamageRatioValue () const
 
AABB GetCollider () const
 
double GetHeight () const
 
double GetWidth () const
 
- Public Member Functions inherited from Botcraft::LivingEntity
 LivingEntity ()
 
virtual ~LivingEntity ()
 
virtual bool IsLivingEntity () const override
 
char GetDataLivingEntityFlags () const
 
float GetDataHealthId () const
 
std::vector< ProtocolCraft::ParticleGetDataEffectParticles () const
 
bool GetDataEffectAmbienceId () const
 
int GetDataArrowCountId () const
 
int GetDataStingerCountId () const
 
std::optional< PositionGetSleepingPosId () const
 
void SetDataLivingEntityFlags (const char data_living_entity_flags)
 
void SetDataHealthId (const float data_health_id)
 
void SetDataEffectParticles (const std::vector< ProtocolCraft::Particle > &data_effect_particles)
 
void SetDataEffectAmbienceId (const bool data_effect_ambience_id)
 
void SetDataArrowCountId (const int data_arrow_count_id)
 
void SetDataStingerCountId (const int data_stinger_count_id)
 
void SetSleepingPosId (const std::optional< Position > &sleeping_pos_id)
 
std::optional< EntityAttributeGetAttribute (const EntityAttribute::Type type) const
 
void SetAttributeBaseValue (const EntityAttribute::Type type, const double value)
 
void RemoveAttributeModifier (const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key)
 
void SetAttributeModifier (const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key, const EntityAttribute::Modifier &modifier)
 
void ClearModifiers (const EntityAttribute::Type type)
 
void AddAttribute (const EntityAttribute &attribute)
 
double GetAttributeMaxHealthValue () const
 
double GetAttributeKnockbackResistanceValue () const
 
double GetAttributeMovementSpeedValue () const
 
double GetAttributeArmorValue () const
 
double GetAttributeArmorToughnessValue () const
 
double GetAttributeMaxAbsorptionValue () const
 
double GetAttributeStepHeightValue () const
 
double GetAttributeScaleValue () const
 
double GetAttributeGravityValue () const
 
double GetAttributeSafeFallDistanceValue () const
 
double GetAttributeFallDamageMultiplierValue () const
 
double GetAttributeJumpStrengthValue () const
 
double GetAttributeOxygenBonusValue () const
 
double GetAttributeBurningTimeValue () const
 
double GetAttributeExplosionKnockbackResistanceValue () const
 
double GetAttributeWaterMovementEfficiencyValue () const
 
double GetAttributeMovementEfficiencyValue () const
 
double GetAttributeAttackKnockbackValue () const
 
- Public Member Functions inherited from Botcraft::Entity
 Entity ()
 
virtual ~Entity ()
 
AABB GetCollider () const
 
double GetWidth () const
 
double GetHeight () const
 
void LoadMetadataFromRawArray (const std::vector< unsigned char > &data)
 
char GetDataSharedFlagsId () const
 
bool GetDataSharedFlagsId (const EntitySharedFlagsId id) const
 
int GetDataAirSupplyId () const
 
std::optional< ProtocolCraft::ChatGetDataCustomName () const
 
bool GetDataCustomNameVisible () const
 
bool GetDataSilent () const
 
bool GetDataNoGravity () const
 
Pose GetDataPose () const
 
int GetDataTicksFrozen () const
 
void SetDataSharedFlagsId (const char data_shared_flags_id)
 
void SetDataSharedFlagsId (const EntitySharedFlagsId id, const bool b)
 
void SetDataAirSupplyId (const int data_air_supply_id)
 
void SetDataCustomName (const std::optional< ProtocolCraft::Chat > &data_custom_name)
 
void SetDataCustomNameVisible (const bool data_custom_name_visible)
 
void SetDataSilent (const bool data_silent)
 
void SetDataNoGravity (const bool data_no_gravity)
 
void SetDataPose (const Pose data_pose)
 
void SetDataTicksFrozen (const int data_ticks_frozen)
 
int GetEntityID () const
 
ProtocolCraft::UUID GetUUID () const
 
Vector3< double > GetPosition () const
 
double GetX () const
 
double GetY () const
 
double GetZ () const
 
float GetYaw () const
 
float GetPitch () const
 
Vector3< double > GetSpeed () const
 
double GetSpeedX () const
 
double GetSpeedY () const
 
double GetSpeedZ () const
 
bool GetOnGround () const
 
std::map< EquipmentSlot, ProtocolCraft::SlotGetEquipments () const
 
ProtocolCraft::Slot GetEquipment (const EquipmentSlot slot) const
 
std::vector< EntityEffectGetEffects () const
 
std::vector< Renderer::FaceGetFaces (const bool reset_uptodate_status)
 
bool GetAreRenderedFacesUpToDate () const
 
void SetEntityID (const int entity_id_)
 
void SetUUID (const ProtocolCraft::UUID &uuid_)
 
virtual void SetPosition (const Vector3< double > &position_)
 
virtual void SetX (const double x_)
 
virtual void SetY (const double y_)
 
virtual void SetZ (const double z_)
 
virtual void SetYaw (const float yaw_)
 
virtual void SetPitch (const float pitch_)
 
void SetSpeed (const Vector3< double > &speed_)
 
void SetSpeedX (const double speed_x_)
 
void SetSpeedY (const double speed_y_)
 
void SetSpeedZ (const double speed_z_)
 
void SetOnGround (const bool on_ground_)
 
void SetEquipment (const EquipmentSlot slot, const ProtocolCraft::Slot &item)
 
void SetEffects (const std::vector< EntityEffect > &effects_)
 
void AddEffect (const EntityEffect &effect)
 
void RemoveEffect (const EntityEffectType type)
 
void SetAreRenderedFacesUpToDate (const bool are_rendered_faces_up_to_date_)
 
virtual bool IsLocalPlayer () const
 
virtual bool IsAbstractArrow () const
 
virtual bool IsAnimal () const
 
virtual bool IsAmbientCreature () const
 
virtual bool IsMonster () const
 
virtual bool IsDisplay () const
 
virtual bool IsVehicle () const
 
virtual bool IsTamableAnimal () const
 
virtual bool IsAbstractSchoolingFish () const
 
virtual bool IsWaterAnimal () const
 
virtual bool IsAbstractChestedHorse () const
 
virtual bool IsAbstractHurtingProjectile () const
 
virtual bool IsMob () const
 
virtual bool IsSpellcasterIllager () const
 
virtual bool IsProjectile () const
 
virtual bool IsFlyingMob () const
 
virtual bool IsAbstractHorse () const
 
virtual bool IsAbstractGolem () const
 
virtual bool IsHangingEntity () const
 
virtual bool IsFireball () const
 
virtual bool IsAbstractMinecart () const
 
virtual bool IsAbstractMinecartContainer () const
 
virtual bool IsShoulderRidingEntity () const
 
virtual bool IsAbstractPiglin () const
 
virtual bool IsAbstractIllager () const
 
virtual bool IsAbstractFish () const
 
virtual bool IsRaider () const
 
virtual bool IsAbstractSkeleton () const
 
virtual bool IsThrowableItemProjectile () const
 
virtual bool IsAbstractVillager () const
 
virtual bool IsAgeableMob () const
 
virtual bool IsPathfinderMob () const
 
virtual bool IsPatrollingMonster () const
 
virtual bool IsThrowableProjectile () const
 
virtual bool IsAbstractWindCharge () const
 
virtual bool IsBlockAttachedEntity () const
 
virtual bool IsAbstractBoat () const
 
virtual bool IsAbstractChestBoat () const
 
virtual bool IsAgeableWaterCreature () const
 
virtual bool IsBoat () const
 
virtual bool IsChestBoat () const
 
virtual bool IsChestRaft () const
 
virtual bool IsRaft () const
 

Static Public Member Functions

static std::string GetClassName ()
 
static EntityType GetClassType ()
 
- Static Public Member Functions inherited from Botcraft::Entity
static std::shared_ptr< EntityCreateEntity (const EntityType type)
 

Protected Member Functions

virtual double GetEyeHeightImpl () const
 
virtual double GetWidthImpl () const override
 
virtual double GetHeightImpl () const override
 
AABB GetColliderImpl (const Pose pose) const
 
double GetAttributePlayerSneakingSpeedValueImpl () const
 
AABB GetColliderImpl () const
 
- Protected Member Functions inherited from Botcraft::LivingEntity
double GetAttributeMovementSpeedValueImpl () const
 
void RemoveAttributeModifierImpl (const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key)
 
void SetAttributeModifierImpl (const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key, const EntityAttribute::Modifier &modifier)
 
char GetDataLivingEntityFlagsImpl () const
 
std::optional< PositionGetSleepingPosIdImpl () const
 
double GetAttributeStepHeightValueImpl () const
 
double GetAttributeGravityValueImpl () const
 
double GetAttributeJumpStrengthValueImpl () const
 
double GetAttributeWaterMovementEfficiencyValueImpl () const
 
double GetAttributeMovementEfficiencyValueImpl () const
 
- Protected Member Functions inherited from Botcraft::Entity
virtual void InitializeFaces ()
 
void OnSizeUpdated ()
 
char GetDataSharedFlagsIdImpl () const
 
bool GetDataSharedFlagsIdImpl (const EntitySharedFlagsId id) const
 
void SetDataSharedFlagsIdImpl (const char data_shared_flags_id)
 
void SetDataSharedFlagsIdImpl (const EntitySharedFlagsId id, const bool b)
 
Pose GetDataPoseImpl () const
 
void SetDataPoseImpl (const Pose data_pose)
 
AABB GetColliderImpl () const
 

Static Protected Attributes

static constexpr int metadata_count = 6
 
static const std::array< std::string, metadata_countmetadata_names
 
static constexpr int hierarchy_metadata_count = LivingEntity::metadata_count + LivingEntity::hierarchy_metadata_count
 
- Static Protected Attributes inherited from Botcraft::LivingEntity
static constexpr int metadata_count = 7
 
static const std::array< std::string, metadata_countmetadata_names
 
static constexpr int hierarchy_metadata_count = Entity::metadata_count + Entity::hierarchy_metadata_count
 
- Static Protected Attributes inherited from Botcraft::Entity
static constexpr int metadata_count = 8
 
static const std::array< std::string, metadata_countmetadata_names
 
static constexpr int hierarchy_metadata_count = 0
 

Additional Inherited Members

- Static Public Attributes inherited from Botcraft::LivingEntity
static const std::string speed_modifier_powder_snow_key = "minecraft:powder_snow"
 
static const std::string speed_modifier_sprinting_key = "minecraft:sprinting"
 
- Protected Attributes inherited from Botcraft::LivingEntity
std::map< EntityAttribute::Type, EntityAttributeattributes
 
- Protected Attributes inherited from Botcraft::Entity
std::shared_mutex entity_mutex
 
int entity_id
 
ProtocolCraft::UUID uuid
 
Vector3< double > position
 
float yaw
 
float pitch
 
Vector3< double > speed
 
bool on_ground
 
std::map< EquipmentSlot, ProtocolCraft::Slotequipments
 Items on this entity.
 
std::vector< EntityEffecteffects
 
std::map< std::string, std::any > metadata
 
std::vector< FaceDescriptorface_descriptors
 
std::vector< Renderer::Facefaces
 
bool are_rendered_faces_up_to_date
 

Detailed Description

Definition at line 8 of file PlayerEntity.hpp.

Constructor & Destructor Documentation

◆ PlayerEntity()

◆ ~PlayerEntity()

Botcraft::PlayerEntity::~PlayerEntity ( )
virtual

Definition at line 44 of file PlayerEntity.cpp.

Member Function Documentation

◆ GetAttributeAttackDamageValue()

double Botcraft::PlayerEntity::GetAttributeAttackDamageValue ( ) const

◆ GetAttributeAttackSpeedValue()

double Botcraft::PlayerEntity::GetAttributeAttackSpeedValue ( ) const

◆ GetAttributeLuckValue()

double Botcraft::PlayerEntity::GetAttributeLuckValue ( ) const

◆ GetAttributePlayerBlockBreakSpeedValue()

double Botcraft::PlayerEntity::GetAttributePlayerBlockBreakSpeedValue ( ) const

◆ GetAttributePlayerBlockInteractionRangeValue()

double Botcraft::PlayerEntity::GetAttributePlayerBlockInteractionRangeValue ( ) const

◆ GetAttributePlayerEntityInteractionRangeValue()

double Botcraft::PlayerEntity::GetAttributePlayerEntityInteractionRangeValue ( ) const

◆ GetAttributePlayerMiningEfficiencyValue()

double Botcraft::PlayerEntity::GetAttributePlayerMiningEfficiencyValue ( ) const

◆ GetAttributePlayerSneakingSpeedValue()

double Botcraft::PlayerEntity::GetAttributePlayerSneakingSpeedValue ( ) const

◆ GetAttributePlayerSneakingSpeedValueImpl()

double Botcraft::PlayerEntity::GetAttributePlayerSneakingSpeedValueImpl ( ) const
protected

◆ GetAttributePlayerSubmergedMiningSpeedValue()

double Botcraft::PlayerEntity::GetAttributePlayerSubmergedMiningSpeedValue ( ) const

◆ GetAttributePlayerSweepingDamageRatioValue()

double Botcraft::PlayerEntity::GetAttributePlayerSweepingDamageRatioValue ( ) const

◆ GetClassName()

std::string Botcraft::PlayerEntity::GetClassName ( )
static

Definition at line 105 of file PlayerEntity.cpp.

◆ GetClassType()

EntityType Botcraft::PlayerEntity::GetClassType ( )
static

Definition at line 110 of file PlayerEntity.cpp.

References Botcraft::Player.

◆ GetCollider() [1/2]

AABB Botcraft::Entity::GetCollider ( ) const

Definition at line 71 of file Entity.cpp.

◆ GetCollider() [2/2]

AABB Botcraft::PlayerEntity::GetCollider ( const Pose  pose) const

Definition at line 61 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and GetColliderImpl().

◆ GetColliderImpl() [1/2]

AABB Botcraft::Entity::GetColliderImpl ( ) const
protected

Definition at line 248 of file Entity.cpp.

References Botcraft::Entity::metadata_names.

Referenced by GetCollider().

◆ GetColliderImpl() [2/2]

AABB Botcraft::PlayerEntity::GetColliderImpl ( const Pose  pose) const
protected

◆ GetDataPlayerAbsorptionId()

float Botcraft::PlayerEntity::GetDataPlayerAbsorptionId ( ) const

Definition at line 159 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by Serialize().

◆ GetDataPlayerMainHand()

char Botcraft::PlayerEntity::GetDataPlayerMainHand ( ) const

Definition at line 177 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by Serialize().

◆ GetDataPlayerModeCustomisation()

char Botcraft::PlayerEntity::GetDataPlayerModeCustomisation ( ) const

Definition at line 171 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by Serialize().

◆ GetDataScoreId()

int Botcraft::PlayerEntity::GetDataScoreId ( ) const

Definition at line 165 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by Serialize().

◆ GetDataShoulderLeft()

ProtocolCraft::NBT::Value Botcraft::PlayerEntity::GetDataShoulderLeft ( ) const

Definition at line 183 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by Serialize().

◆ GetDataShoulderRight()

ProtocolCraft::NBT::Value Botcraft::PlayerEntity::GetDataShoulderRight ( ) const

Definition at line 189 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by Serialize().

◆ GetEyeHeight()

double Botcraft::PlayerEntity::GetEyeHeight ( ) const

Definition at line 98 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and GetEyeHeightImpl().

◆ GetEyeHeightImpl()

double Botcraft::PlayerEntity::GetEyeHeightImpl ( ) const
protectedvirtual

◆ GetHeight() [1/2]

double Botcraft::Entity::GetHeight ( ) const

Definition at line 73 of file Entity.cpp.

Referenced by GetColliderImpl(), and GetHeightImpl().

◆ GetHeight() [2/2]

double Botcraft::PlayerEntity::GetHeight ( const Pose  pose) const

◆ GetHeightImpl()

double Botcraft::PlayerEntity::GetHeightImpl ( ) const
overrideprotectedvirtual

Reimplemented from Botcraft::Entity.

Definition at line 336 of file PlayerEntity.cpp.

References Botcraft::Entity::GetDataPoseImpl(), and GetHeight().

◆ GetName()

std::string Botcraft::PlayerEntity::GetName ( ) const
overridevirtual

Get the name of this entity TYPE as a string. For player name see NetworkManager::GetMyName()

Implements Botcraft::Entity.

Definition at line 50 of file PlayerEntity.cpp.

◆ GetType()

EntityType Botcraft::PlayerEntity::GetType ( ) const
overridevirtual

Implements Botcraft::Entity.

Definition at line 55 of file PlayerEntity.cpp.

References Botcraft::Player.

◆ GetWidth() [1/2]

double Botcraft::Entity::GetWidth ( ) const

Definition at line 72 of file Entity.cpp.

Referenced by GetColliderImpl(), and GetWidthImpl().

◆ GetWidth() [2/2]

double Botcraft::PlayerEntity::GetWidth ( const Pose  pose) const

Definition at line 85 of file PlayerEntity.cpp.

References Botcraft::Dying, and Botcraft::Sleeping.

◆ GetWidthImpl()

double Botcraft::PlayerEntity::GetWidthImpl ( ) const
overrideprotectedvirtual

Reimplemented from Botcraft::Entity.

Definition at line 327 of file PlayerEntity.cpp.

References Botcraft::Entity::GetDataPoseImpl(), and GetWidth().

◆ IsRemotePlayer()

bool Botcraft::PlayerEntity::IsRemotePlayer ( ) const
overridevirtual

Reimplemented from Botcraft::Entity.

Reimplemented in Botcraft::LocalPlayer.

Definition at line 232 of file PlayerEntity.cpp.

◆ Serialize()

◆ SetDataPlayerAbsorptionId()

void Botcraft::PlayerEntity::SetDataPlayerAbsorptionId ( const float  data_player_absorption_id)

Definition at line 196 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by PlayerEntity().

◆ SetDataPlayerMainHand()

void Botcraft::PlayerEntity::SetDataPlayerMainHand ( const char  data_player_main_hand)

Definition at line 214 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by PlayerEntity().

◆ SetDataPlayerModeCustomisation()

void Botcraft::PlayerEntity::SetDataPlayerModeCustomisation ( const char  data_player_mode_customisation)

Definition at line 208 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by PlayerEntity().

◆ SetDataScoreId()

void Botcraft::PlayerEntity::SetDataScoreId ( const int  data_score_id)

Definition at line 202 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by PlayerEntity().

◆ SetDataShoulderLeft()

void Botcraft::PlayerEntity::SetDataShoulderLeft ( const ProtocolCraft::NBT::Value data_shoulder_left)

Definition at line 220 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by PlayerEntity().

◆ SetDataShoulderRight()

void Botcraft::PlayerEntity::SetDataShoulderRight ( const ProtocolCraft::NBT::Value data_shoulder_right)

Definition at line 226 of file PlayerEntity.cpp.

References Botcraft::Entity::entity_mutex, and Botcraft::Entity::metadata.

Referenced by PlayerEntity().

◆ SetMetadataValue()

void Botcraft::PlayerEntity::SetMetadataValue ( const int  index,
const std::any &  value 
)
overridevirtual

Member Data Documentation

◆ hierarchy_metadata_count

constexpr int Botcraft::PlayerEntity::hierarchy_metadata_count = LivingEntity::metadata_count + LivingEntity::hierarchy_metadata_count
staticconstexprprotected

Definition at line 13 of file PlayerEntity.hpp.

Referenced by SetMetadataValue().

◆ metadata_count

constexpr int Botcraft::PlayerEntity::metadata_count = 6
staticconstexprprotected

Definition at line 11 of file PlayerEntity.hpp.

Referenced by SetMetadataValue().

◆ metadata_names

const std::array< std::string, PlayerEntity::metadata_count > Botcraft::PlayerEntity::metadata_names
staticprotected
Initial value:
{ {
"data_player_absorption_id",
"data_score_id",
"data_player_mode_customisation",
"data_player_main_hand",
"data_shoulder_left",
"data_shoulder_right",
} }

Definition at line 12 of file PlayerEntity.hpp.

Referenced by SetMetadataValue().


The documentation for this class was generated from the following files: