56 static std::unique_ptr<cProjectileEntity>
Create(
67 static std::unique_ptr<cProjectileEntity>
Create(
70 double a_PosX,
double a_PosY,
double a_PosZ,
75 return Create(a_Kind, a_Creator, {a_PosX, a_PosY, a_PosZ}, a_Item, a_Speed);
142 virtual void Tick(std::chrono::milliseconds a_Dt,
cChunk & a_Chunk)
override;
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
#define CLASS_PROTODEF(classname)
Class that stores item enchantments or stored-enchantments The enchantments may be serialized to a st...
cEntity(eEntityType a_EntityType, Vector3d a_Pos, float a_Width, float a_Height)
UInt32 GetCreatorUniqueID(void) const
Returns the unique ID of the entity who created this projectile May return an ID <0.
eKind
The kind of the projectile.
eKind m_ProjectileKind
The type of projectile I am.
cProjectileEntity(eKind a_Kind, cEntity *a_Creator, Vector3d a_Pos, float a_Width, float a_Height)
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Handles the physics of the entity - updates position based on speed, updates speed based on environme...
virtual void OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace)
Called by the physics blocktracer when the entity hits a solid block, the hit position and the face h...
static std::unique_ptr< cProjectileEntity > Create(eKind a_Kind, cEntity *a_Creator, Vector3d a_Pos, const cItem *a_Item, const Vector3d *a_Speed=nullptr)
Creates a new instance of the specified projectile entity.
CreatorData m_CreatorData
The structure for containing the entity ID and name who has created this projectile The ID and / or n...
bool IsInGround(void) const
Returns true if the projectile has hit the ground and is stuck there.
AString GetCreatorName(void) const
Returns the name of the player that created the projectile Will be empty for non-player creators.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
bool m_IsInGround
True if the projectile has hit the ground and is stuck there.
virtual void CollectedBy(cPlayer &a_Dest)
Called by Chunk when the projectile is eligible for player collection.
AString GetMCAClassName(void) const
Returns the string that is used as the entity type (class name) in MCA files.
virtual void OnHitEntity(cEntity &a_EntityHit, Vector3d a_HitPos)
Called by the physics blocktracer when the entity hits another entity.
eKind GetProjectileKind(void) const
Returns the kind of the projectile (fast class identification)
virtual void SpawnOn(cClientHandle &a_Client) final override
Descendants override this function to send a command to the specified client to spawn the entity on t...
void SetIsInGround(bool a_IsInGround)
Sets the internal InGround flag.
static std::unique_ptr< cProjectileEntity > Create(eKind a_Kind, cEntity *a_Creator, double a_PosX, double a_PosY, double a_PosZ, const cItem *a_Item, const Vector3d *a_Speed=nullptr)
OBSOLETE, use the Vector3d-based overload instead.
A structure that stores the Entity ID and Playername of the projectile's creator Used to migitate inv...
cEnchantments m_Enchantments
CreatorData(UInt32 a_UniqueID, const AString &a_Name, const cEnchantments &a_Enchantments)