5 #include "../ClientHandle.h"
9 Super(etExpOrb, a_Pos, 0.5f, 0.5f),
43 a_PlayerPos.
y += 0.8f;
63 CurrentSpeed += SpeedDelta;
64 if (CurrentSpeed.
Length() > 12)
85 if (
m_Timer >= std::chrono::minutes(5))
112 const static std::array<int, 11> BaseValue = {{1, 3, 7, 17, 37, 73, 149, 307, 617, 1237, 2477}};
114 std::vector<int> Rewards;
115 size_t Index = BaseValue.size() - 1;
119 while (a_Reward < BaseValue[Index])
124 a_Reward -= BaseValue[Index];
125 Rewards.push_back(BaseValue[Index]);
unsigned char Distance(const BlockState Block)
void SendExperienceOrb(const cExpOrb &a_ExpOrb)
const Vector3d & GetSpeed(void) const
Exported in ManualBindings.
bool m_bDirtyOrientation
Stores whether our yaw / pitch / roll (body orientation) has been set manually.
void SetHealth(float a_Health)
Sets the health of this entity; doesn't broadcast any hurt animation.
float m_Gravity
Stores gravity that is applied to an entity every tick For realistic effects, this should be negative...
void SetGravity(float a_Gravity)
void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
Sets the speed of the entity, measured in m / sec.
virtual void DetectCacti(void)
Detects the time for application of cacti damage.
UInt32 GetUniqueID(void) const
void Destroy()
Destroys the entity, schedules it for memory freeing and broadcasts the DestroyEntity packet.
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
Handles the physics of the entity - updates position based on speed, updates speed based on environme...
void SetAirDrag(float a_AirDrag)
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI)
Makes this entity take damage specified in the a_TDI.
void SetMaxHealth(float a_MaxHealth)
Sets the maximum value for the health.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
long int m_TicksAlive
The number of ticks this entity has been alive for.
bool m_bDirtyHead
Stores whether head yaw has been set manually.
virtual void BroadcastMovementUpdate(const cClientHandle *a_Exclude=nullptr)
Updates clients of changes in the entity.
cExpOrb(Vector3d a_Pos, int a_Reward)
static std::vector< int > Split(int a_Reward)
Split reward into small values according to regular Minecraft rules.
std::chrono::milliseconds m_Timer
The number of ticks that the entity has existed / timer between collect and destroy; in msec.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void SpawnOn(cClientHandle &a_Client) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
int DeltaExperience(int a_Xp_delta)
double Length(void) const
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
bool DoWithNearestPlayer(Vector3d a_Pos, double a_RangeLimit, cPlayerListCallback a_Callback, bool a_CheckLineOfSight=true, bool a_IgnoreSpectator=true)
Calls the callback for nearest player for given position, Returns false if player not found,...