56#if PROTOCOL_VERSION > 767
354 const float new_pitch =
static_cast<float>(-std::asin(direction.
y) * 57.29577951308232 );
355 float new_yaw =
static_cast<float>(-std::atan2(direction.
x, direction.
z) * 57.29577951308232 );
360 if (new_yaw !=
yaw ||
361 (set_pitch && new_pitch !=
pitch))
373 const float rad_yaw =
yaw * 0.017453292f ;
374 const float rad_pitch =
pitch * 0.017453292f ;
375 const float cos_pitch =
CosLUT(rad_pitch);
381 const float rad_yaw =
yaw * 0.017453292f ;
382 const float rad_pitch =
pitch * 0.017453292f ;
383 const float cos_pitch =
CosLUT(rad_pitch);
384 return -
SinLUT(rad_yaw) * cos_pitch;
389 const float rad_pitch =
pitch * 0.017453292f ;
390 return -
SinLUT(rad_pitch);
395 const float rad_yaw =
yaw * 0.017453292f ;
396 const float rad_pitch =
pitch * 0.017453292f ;
397 const float cos_pitch =
CosLUT(rad_pitch);
398 return CosLUT(rad_yaw) * cos_pitch;
403 const float rad_yaw =
yaw * 0.017453292f ;
410 const float rad_yaw =
yaw * 0.017453292f ;
444#if PROTOCOL_VERSION < 405
float SinLUT(const double d)
float CosLUT(const double d)
virtual double GetHeightImpl() const
std::shared_mutex entity_mutex
Vector3< double > position
void SetFoodSaturation(const float food_saturation_)
void SetAbilitiesFlags(const char abilities_flags_)
void SetInputsLeft(const float f)
float GetFoodSaturation() const
void SetFood(const int food_)
double GetFrontVectorXImpl() const
Vector3< double > GetXZVectorImpl() const
bool horizontal_collision
virtual bool IsLocalPlayer() const override
Vector3< double > GetFrontVectorImpl() const
virtual void SetPitch(const float pitch_) override
Set Pitch angle (look up is -90°, look down is 90°)
virtual void SetPosition(const Vector3< double > &pos) override
void SetInputsForward(const float f)
virtual void SetZ(const double z) override
float GetFlyingSpeed() const
void SetInputsSprint(const bool b)
Vector3< double > GetRightVector() const
PlayerInputs last_sent_inputs
char GetAbilitiesFlags() const
bool previous_horizontal_collision
void SetFlyingSpeed(const float flying_speed_)
double GetFrontVectorYImpl() const
int sprint_double_tap_trigger_time
Vector3< double > stuck_speed_multiplier
int fly_jump_trigger_time
virtual void SetY(const double y) override
void AddInputsForward(const float f)
void SetAbilitiesFlagsImpl(const char abilities_flags_)
bool GetInvulnerable() const
void SetWalkingSpeed(const float walking_speed_)
bool flying
Flying in creative/spectator.
bool GetDirtyInputs() const
Vector3< double > GetXZVector() const
GameType GetGameMode() const
void SetInputs(const PlayerInputs &inputs_)
void AddInputsLeft(const float f)
void UpdateAbilitiesFlagsImpl()
Vector3< double > GetRightVectorImpl() const
std::optional< int > pending_teleport_id
double GetFrontVectorZImpl() const
std::optional< Position > supporting_block_pos
virtual void SetX(const double x) override
void SetHealth(const float health_)
virtual void SetYaw(const float yaw_) override
Set Yaw angle (horizontal plane orientation)
virtual bool IsRemotePlayer() const override
void SetInputsJump(const bool b)
void LookAt(const Vector3< double > &pos, const bool set_pitch=false)
float GetWalkingSpeed() const
Vector3< double > GetFrontVector() const
bool may_fly
If this player can fly in creative/spectator.
void SetGameMode(const GameType game_mode_)
bool on_ground_without_supporting_block
bool previous_shift_key_down
bool instabuild
Insta break blocks in creative.
bool GetInstabuild() const
If true, the player can break any block in no time (creative mode)
Vector3< double > previous_position
void SetInputsSneak(const bool b)
virtual double GetEyeHeightImpl() const