4 #include "../BlockInfo.h"
5 #include "../BoundingBox.h"
9 #include "../ClientHandle.h"
29 if (!a_Entity.
IsMob())
78 Super(etFloater, a_Pos, 0.25f, 0.25f),
80 m_CanPickupItem(false),
82 m_CountDownTime(a_CountDownTime),
83 m_PlayerID(a_PlayerID),
84 m_AttachedMobID(
cEntity::INVALID_ID)
113 if (
IsBlockWater(Chunk->GetBlock(Rel)) && (Chunk->GetMeta(Rel) == 0))
140 if (Chunk->IsWeatherWetAt(Rel))
142 if (Random.RandBool(0.25))
149 if (Random.RandBool())
172 LOGD(
"The fish is gone. Floater %i can not pick an item up.",
GetUniqueID());
bool IsBlockWater(BLOCKTYPE a_BlockType)
#define PREPARE_REL_AND_CHUNK(Position, OriginalChunk)
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
std::enable_if< std::is_arithmetic< T >::value, C >::type FloorC(T a_Value)
Floors a value, then casts it to C (an int by default).
bool ForEachEntity(cEntityCallback a_Callback) const
Calls the callback for each entity; returns true if all entities processed, false if the callback abo...
void SendSpawnEntity(const cEntity &a_Entity)
const Vector3d & GetSpeed(void) const
Exported in ManualBindings.
cBoundingBox GetBoundingBox() const
void SetSpeedX(double a_SpeedX)
Sets the speed in the X axis, leaving the other speed components intact.
double GetSpeedZ(void) const
static const UInt32 INVALID_ID
Special ID that is considered an "invalid value", signifying no entity.
void SetSpeedY(double a_SpeedY)
Sets the speed in the Y axis, leaving the other speed components intact.
void SetSpeedZ(double a_SpeedZ)
Sets the speed in the Z axis, leaving the other speed components intact.
void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
Sets the speed of the entity, measured in m / sec.
double GetPosX(void) const
float GetWidth(void) const
double GetPosZ(void) const
UInt32 GetUniqueID(void) const
void Destroy()
Destroys the entity, schedules it for memory freeing and broadcasts the DestroyEntity packet.
void AddSpeedY(double a_AddSpeedY)
double GetPosY(void) const
void TakeDamage(cEntity &a_Attacker)
Makes this pawn take damage from an attack by a_Attacker.
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...
float GetHeight(void) const
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
void AttachTo(cEntity &a_AttachTo)
Attaches to the specified entity; detaches from any previous one first.
virtual void BroadcastMovementUpdate(const cClientHandle *a_Exclude=nullptr)
Updates clients of changes in the entity.
double GetSpeedX(void) const
bool operator()(cEntity &a_Entity)
const Vector3d & m_NextPos
cFloaterEntityCollisionCallback(cFloater *a_Floater, const Vector3d &a_Pos, const Vector3d &a_NextPos)
bool HasHit(void) const
Returns true if the callback has encountered a true hit.
cEntity * GetHitEntity(void) const
Returns the nearest entity that was hit, after the enumeration has been completed.
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 void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
cFloater(Vector3d a_Pos, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime)
bool CanPickup(void) const
void Set(T a_x, T a_y, T a_z)
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
bool DoWithEntityByID(UInt32 a_UniqueID, cEntityCallback a_Callback)
Calls the callback if the entity with the specified ID is found, with the entity object as the callba...
virtual void BroadcastParticleEffect(const AString &a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override