From 365cbc6e1cea96741e26c9ce912b003f8fd2c62c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 29 Sep 2019 14:59:24 +0200 Subject: Refactored more of Entities and BlockEntities to use Vector3. (#4403) --- src/Entities/ProjectileEntity.h | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'src/Entities/ProjectileEntity.h') diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index 36f53c841..c74fdd6af 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -20,9 +20,15 @@ class cProjectileEntity : public cEntity { - typedef cEntity super; + // tolua_end + + using super = cEntity; + + // tolua_begin + public: + /** The kind of the projectile. The numbers correspond to the network type ID used for spawning them in the protocol. */ enum eKind { @@ -43,10 +49,32 @@ public: CLASS_PROTODEF(cProjectileEntity) - cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height); - cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height); - - static std::unique_ptr Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem * a_Item, const Vector3d * a_Speed = nullptr); + cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, double a_Width, double a_Height); + cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, double a_Width, double a_Height); + + /** Creates a new instance of the specified projectile entity. + a_Item is the item from which the projectile originated (such as firework or arrow). */ + static std::unique_ptr Create( + eKind a_Kind, + cEntity * a_Creator, + Vector3d a_Pos, + const cItem * a_Item, + const Vector3d * a_Speed = nullptr + ); + + /** OBSOLETE, use the Vector3d-based overload instead. + Creates a new instance of the specified projectile entity. + a_Item is the item from which the projectile originated (such as firework or arrow). */ + static std::unique_ptr 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 + ) + { + return Create(a_Kind, a_Creator, {a_PosX, a_PosY, a_PosZ}, a_Item, a_Speed); + } /** Called by the physics blocktracer when the entity hits a solid block, the hit position and the face hit (BLOCK_FACE_) is given */ virtual void OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace); -- cgit v1.2.3