summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-09-29 14:59:24 +0200
committerGitHub <noreply@github.com>2019-09-29 14:59:24 +0200
commit365cbc6e1cea96741e26c9ce912b003f8fd2c62c (patch)
treef23682c47928597791c53f3a300b03494ffde417 /src/Entities
parentCactus can now grow and will be dropped if there is no place to grow. (diff)
downloadcuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar
cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.gz
cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.bz2
cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.lz
cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.xz
cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.zst
cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/ArrowEntity.cpp4
-rw-r--r--src/Entities/ArrowEntity.h10
-rw-r--r--src/Entities/Boat.cpp2
-rw-r--r--src/Entities/Boat.h4
-rw-r--r--src/Entities/EnderCrystal.cpp4
-rw-r--r--src/Entities/EnderCrystal.h5
-rw-r--r--src/Entities/Entity.cpp8
-rw-r--r--src/Entities/Entity.h6
-rw-r--r--src/Entities/ExpBottleEntity.cpp12
-rw-r--r--src/Entities/ExpBottleEntity.h8
-rw-r--r--src/Entities/ExpOrb.cpp23
-rw-r--r--src/Entities/ExpOrb.h3
-rw-r--r--src/Entities/FallingBlock.cpp4
-rw-r--r--src/Entities/FallingBlock.h13
-rw-r--r--src/Entities/FireChargeEntity.cpp4
-rw-r--r--src/Entities/FireChargeEntity.h8
-rw-r--r--src/Entities/FireworkEntity.cpp4
-rw-r--r--src/Entities/FireworkEntity.h8
-rw-r--r--src/Entities/Floater.cpp6
-rw-r--r--src/Entities/Floater.h9
-rw-r--r--src/Entities/GhastFireballEntity.cpp4
-rw-r--r--src/Entities/GhastFireballEntity.h8
-rw-r--r--src/Entities/HangingEntity.cpp4
-rw-r--r--src/Entities/HangingEntity.h8
-rw-r--r--src/Entities/ItemFrame.cpp4
-rw-r--r--src/Entities/ItemFrame.h8
-rw-r--r--src/Entities/LeashKnot.cpp4
-rw-r--r--src/Entities/LeashKnot.h9
-rw-r--r--src/Entities/Minecart.cpp27
-rw-r--r--src/Entities/Minecart.h35
-rw-r--r--src/Entities/Painting.cpp4
-rw-r--r--src/Entities/Painting.h8
-rw-r--r--src/Entities/Pawn.cpp2
-rw-r--r--src/Entities/Pickup.cpp21
-rw-r--r--src/Entities/Pickup.h9
-rw-r--r--src/Entities/ProjectileEntity.cpp36
-rw-r--r--src/Entities/ProjectileEntity.h38
-rw-r--r--src/Entities/SplashPotionEntity.cpp8
-rw-r--r--src/Entities/SplashPotionEntity.h10
-rw-r--r--src/Entities/TNTEntity.cpp2
-rw-r--r--src/Entities/ThrownEggEntity.cpp4
-rw-r--r--src/Entities/ThrownEggEntity.h8
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp4
-rw-r--r--src/Entities/ThrownEnderPearlEntity.h8
-rw-r--r--src/Entities/ThrownSnowballEntity.cpp4
-rw-r--r--src/Entities/ThrownSnowballEntity.h8
-rw-r--r--src/Entities/WitherSkullEntity.cpp4
-rw-r--r--src/Entities/WitherSkullEntity.h8
48 files changed, 239 insertions, 203 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index 0fc0f095d..adbee3cf8 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -8,8 +8,8 @@
-cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkArrow, a_Creator, a_X, a_Y, a_Z, 0.5, 0.5),
+cArrowEntity::cArrowEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkArrow, a_Creator, a_Pos, 0.5, 0.5),
m_PickupState(psNoPickup),
m_DamageCoeff(2),
m_IsCritical(false),
diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h
index 4d4891ce4..629fd8987 100644
--- a/src/Entities/ArrowEntity.h
+++ b/src/Entities/ArrowEntity.h
@@ -20,9 +20,15 @@
class cArrowEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
+
+ using super = cProjectileEntity;
+
+ // tolua_begin
+
public:
+
/** Determines when the arrow can be picked up (depending on player gamemode). Corresponds to the MCA file "pickup" field */
enum ePickupState
{
@@ -36,7 +42,7 @@ public:
CLASS_PROTODEF(cArrowEntity)
/** Creates a new arrow with psNoPickup state and default damage modifier coeff */
- cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cArrowEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
/** Creates a new arrow as shot by a player, initializes it from the player object */
cArrowEntity(cPlayer & a_Player, double a_Force);
diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp
index 7a6d0d620..c05e67275 100644
--- a/src/Entities/Boat.cpp
+++ b/src/Entities/Boat.cpp
@@ -14,7 +14,7 @@
cBoat::cBoat(Vector3d a_Pos, eMaterial a_Material) :
- super(etBoat, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.7),
+ super(etBoat, a_Pos, 0.98, 0.7),
m_LastDamage(0), m_ForwardDirection(0),
m_DamageTaken(0.0f), m_Material(a_Material),
m_RightPaddleUsed(false), m_LeftPaddleUsed(false)
diff --git a/src/Entities/Boat.h b/src/Entities/Boat.h
index 1a00d48c9..aa6dc0637 100644
--- a/src/Entities/Boat.h
+++ b/src/Entities/Boat.h
@@ -35,6 +35,8 @@ public:
CLASS_PROTODEF(cBoat)
+ cBoat(Vector3d a_Pos, eMaterial a_Material);
+
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
@@ -42,8 +44,6 @@ public:
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) override;
- cBoat(Vector3d a_Pos, eMaterial a_Material);
-
int GetLastDamage(void) const { return m_LastDamage; }
int GetForwardDirection(void) const { return m_ForwardDirection; }
diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp
index d3725e14a..dc9872936 100644
--- a/src/Entities/EnderCrystal.cpp
+++ b/src/Entities/EnderCrystal.cpp
@@ -10,8 +10,8 @@
-cEnderCrystal::cEnderCrystal(double a_X, double a_Y, double a_Z)
- : cEntity(etEnderCrystal, a_X, a_Y, a_Z, 1.0, 1.0)
+cEnderCrystal::cEnderCrystal(Vector3d a_Pos):
+ super(etEnderCrystal, a_Pos, 1.0, 1.0)
{
SetMaxHealth(5);
}
diff --git a/src/Entities/EnderCrystal.h b/src/Entities/EnderCrystal.h
index 8f7e2e9b9..d8e295a3c 100644
--- a/src/Entities/EnderCrystal.h
+++ b/src/Entities/EnderCrystal.h
@@ -12,12 +12,13 @@ class cEnderCrystal :
public cEntity
{
// tolua_end
- typedef cEntity super;
+ using super = cEntity;
public:
+
CLASS_PROTODEF(cEnderCrystal)
- cEnderCrystal(double a_X, double a_Y, double a_Z);
+ cEnderCrystal(Vector3d a_Pos);
private:
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index efeff5d66..9779c90de 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -32,7 +32,7 @@ static UInt32 GetNextUniqueID(void)
////////////////////////////////////////////////////////////////////////////////
// cEntity:
-cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, double a_Width, double a_Height):
+cEntity::cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height):
m_UniqueID(GetNextUniqueID()),
m_Health(1),
m_MaxHealth(1),
@@ -44,7 +44,7 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
m_bOnGround(false),
m_Gravity(-9.81f),
m_AirDrag(0.02f),
- m_LastPosition(a_X, a_Y, a_Z),
+ m_LastPosition(a_Pos),
m_EntityType(a_EntityType),
m_World(nullptr),
m_IsWorldChangeScheduled(false),
@@ -65,8 +65,8 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
m_ParentChunk(nullptr),
m_HeadYaw(0.0),
m_Rot(0.0, 0.0, 0.0),
- m_Position(a_X, a_Y, a_Z),
- m_LastSentPosition(a_X, a_Y, a_Z),
+ m_Position(a_Pos),
+ m_LastSentPosition(a_Pos),
m_WaterSpeed(0, 0, 0),
m_Mass (0.001), // Default 1g
m_Width(a_Width),
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 594acdd89..2805ee9e0 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -156,7 +156,7 @@ public:
static const UInt32 INVALID_ID = 0; // Exported to Lua in ManualBindings.cpp, ToLua doesn't parse initialized constants.
- cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, double a_Width, double a_Height);
+ cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height);
virtual ~cEntity();
/** Spawns the entity in the world; returns true if spawned, false if not (plugin disallowed).
@@ -558,7 +558,9 @@ public:
@return exposure rate */
virtual float GetExplosionExposureRate(Vector3d a_ExplosionPosition, float a_ExlosionPower);
+
protected:
+
/** Structure storing the portal delay timer and cooldown boolean */
struct sPortalCooldownData
{
@@ -570,6 +572,7 @@ protected:
bool m_ShouldPreventTeleportation;
};
+
/** Measured in meters / second (m / s) */
Vector3d m_Speed;
@@ -686,6 +689,7 @@ protected:
Only to be used when the caller will broadcast a teleport or equivalent to clients. */
virtual void ResetPosition(Vector3d a_NewPos);
+
private:
/** Whether the entity is ticking or not. If not, it is scheduled for removal or world-teleportation. */
diff --git a/src/Entities/ExpBottleEntity.cpp b/src/Entities/ExpBottleEntity.cpp
index 8c28458bd..ed6c759bc 100644
--- a/src/Entities/ExpBottleEntity.cpp
+++ b/src/Entities/ExpBottleEntity.cpp
@@ -8,18 +8,8 @@
-cExpBottleEntity::cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, Vector3d a_Speed) :
- super(pkExpBottle, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25)
-{
- SetSpeed(a_Speed);
-}
-
-
-
-
-
cExpBottleEntity::cExpBottleEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed) :
- super(pkExpBottle, a_Creator, a_Pos.x, a_Pos.y, a_Pos.z, 0.25, 0.25)
+ super(pkExpBottle, a_Creator, a_Pos, 0.25, 0.25)
{
SetSpeed(a_Speed);
}
diff --git a/src/Entities/ExpBottleEntity.h b/src/Entities/ExpBottleEntity.h
index 1fcc9b138..126898556 100644
--- a/src/Entities/ExpBottleEntity.h
+++ b/src/Entities/ExpBottleEntity.h
@@ -20,16 +20,14 @@
class cExpBottleEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cExpBottleEntity)
- cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, Vector3d a_Speed);
-
cExpBottleEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected:
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index eda96bbc5..ad6f6e97d 100644
--- a/src/Entities/ExpOrb.cpp
+++ b/src/Entities/ExpOrb.cpp
@@ -5,25 +5,10 @@
#include "../ClientHandle.h"
-cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward)
- : cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98)
- , m_Reward(a_Reward)
- , m_Timer(0)
-{
- SetMaxHealth(5);
- SetHealth(5);
- SetGravity(-16);
- SetAirDrag(0.02f);
-}
-
-
-
-
-
-cExpOrb::cExpOrb(const Vector3d & a_Pos, int a_Reward)
- : cEntity(etExpOrb, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98)
- , m_Reward(a_Reward)
- , m_Timer(0)
+cExpOrb::cExpOrb(Vector3d a_Pos, int a_Reward):
+ super(etExpOrb, a_Pos, 0.98, 0.98), // TODO: Check size
+ m_Reward(a_Reward),
+ m_Timer(0)
{
SetMaxHealth(5);
SetHealth(5);
diff --git a/src/Entities/ExpOrb.h b/src/Entities/ExpOrb.h
index c4519e963..326e28b1d 100644
--- a/src/Entities/ExpOrb.h
+++ b/src/Entities/ExpOrb.h
@@ -18,8 +18,7 @@ public:
CLASS_PROTODEF(cExpOrb)
- cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward);
- cExpOrb(const Vector3d & a_Pos, int a_Reward);
+ cExpOrb(Vector3d a_Pos, int a_Reward);
// Override functions
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp
index 0e03d50ce..55b9e81e1 100644
--- a/src/Entities/FallingBlock.cpp
+++ b/src/Entities/FallingBlock.cpp
@@ -10,8 +10,8 @@
-cFallingBlock::cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
- super(etFallingBlock, a_BlockPosition.x + 0.5f, a_BlockPosition.y, a_BlockPosition.z + 0.5f, 0.98, 0.98),
+cFallingBlock::cFallingBlock(Vector3i a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
+ super(etFallingBlock, Vector3d(0.5, 0, 0.5) + a_BlockPosition, 0.98, 0.98),
m_BlockType(a_BlockType),
m_BlockMeta(a_BlockMeta),
m_OriginalPosition(a_BlockPosition)
diff --git a/src/Entities/FallingBlock.h b/src/Entities/FallingBlock.h
index 6a7297e9c..e4e9582d8 100644
--- a/src/Entities/FallingBlock.h
+++ b/src/Entities/FallingBlock.h
@@ -8,19 +8,20 @@
// tolua_begin
-
class cFallingBlock :
public cEntity
{
- typedef cEntity super;
-
-public:
// tolua_end
+ using super = cEntity;
+
+public: // tolua_export
+
CLASS_PROTODEF(cFallingBlock)
- /** Creates a new falling block. a_BlockPosition is expected in world coords */
- cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ /** Creates a new falling block.
+ a_BlockPosition is expected in world coords */
+ cFallingBlock(Vector3i a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
// tolua_begin
diff --git a/src/Entities/FireChargeEntity.cpp b/src/Entities/FireChargeEntity.cpp
index 5432f9206..2e544ee5d 100644
--- a/src/Entities/FireChargeEntity.cpp
+++ b/src/Entities/FireChargeEntity.cpp
@@ -7,8 +7,8 @@
-cFireChargeEntity::cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkFireCharge, a_Creator, a_X, a_Y, a_Z, 0.3125, 0.3125)
+cFireChargeEntity::cFireChargeEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkFireCharge, a_Creator, a_Pos, 0.3125, 0.3125)
{
SetSpeed(a_Speed);
SetGravity(0);
diff --git a/src/Entities/FireChargeEntity.h b/src/Entities/FireChargeEntity.h
index 2ea64d1e3..ef5ecd075 100644
--- a/src/Entities/FireChargeEntity.h
+++ b/src/Entities/FireChargeEntity.h
@@ -20,15 +20,15 @@
class cFireChargeEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cFireChargeEntity)
- cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cFireChargeEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected:
diff --git a/src/Entities/FireworkEntity.cpp b/src/Entities/FireworkEntity.cpp
index b0ba4e6c5..b4050d07b 100644
--- a/src/Entities/FireworkEntity.cpp
+++ b/src/Entities/FireworkEntity.cpp
@@ -8,8 +8,8 @@
-cFireworkEntity::cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item) :
- super(pkFirework, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
+cFireworkEntity::cFireworkEntity(cEntity * a_Creator, Vector3d a_Pos, const cItem & a_Item) :
+ super(pkFirework, a_Creator, a_Pos, 0.25, 0.25),
m_TicksToExplosion(a_Item.m_FireworkItem.m_FlightTimeInTicks),
m_FireworkItem(a_Item)
{
diff --git a/src/Entities/FireworkEntity.h b/src/Entities/FireworkEntity.h
index 228960fb1..20689165f 100644
--- a/src/Entities/FireworkEntity.h
+++ b/src/Entities/FireworkEntity.h
@@ -20,15 +20,15 @@
class cFireworkEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cFireworkEntity)
- cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item);
+ cFireworkEntity(cEntity * a_Creator, Vector3d a_Pos, const cItem & a_Item);
// tolua_begin
diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp
index d70cb4345..c9cc526a7 100644
--- a/src/Entities/Floater.cpp
+++ b/src/Entities/Floater.cpp
@@ -73,9 +73,9 @@ protected:
-cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime) :
- cEntity(etFloater, a_X, a_Y, a_Z, 0.2, 0.2),
- m_BitePos(Vector3d(a_X, a_Y, a_Z)),
+cFloater::cFloater(Vector3d a_Pos, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime) :
+ super(etFloater, a_Pos, 0.2, 0.2),
+ m_BitePos(a_Pos),
m_CanPickupItem(false),
m_PickupCountDown(0),
m_CountDownTime(a_CountDownTime),
diff --git a/src/Entities/Floater.h b/src/Entities/Floater.h
index 59402393f..25a80996a 100644
--- a/src/Entities/Floater.h
+++ b/src/Entities/Floater.h
@@ -11,14 +11,15 @@
class cFloater :
public cEntity
{
- typedef cEntity super;
-
-public:
// tolua_end
+ using super = cEntity;
+
+public: // tolua_export
+
CLASS_PROTODEF(cFloater)
- cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime);
+ cFloater(Vector3d a_Pos, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime);
virtual void SpawnOn(cClientHandle & a_Client) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
diff --git a/src/Entities/GhastFireballEntity.cpp b/src/Entities/GhastFireballEntity.cpp
index 2dbfbf481..8a84a99d6 100644
--- a/src/Entities/GhastFireballEntity.cpp
+++ b/src/Entities/GhastFireballEntity.cpp
@@ -7,8 +7,8 @@
-cGhastFireballEntity::cGhastFireballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkGhastFireball, a_Creator, a_X, a_Y, a_Z, 1, 1)
+cGhastFireballEntity::cGhastFireballEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkGhastFireball, a_Creator, a_Pos, 1, 1)
{
SetSpeed(a_Speed);
SetGravity(0);
diff --git a/src/Entities/GhastFireballEntity.h b/src/Entities/GhastFireballEntity.h
index bf5b333e2..ba1fb424b 100644
--- a/src/Entities/GhastFireballEntity.h
+++ b/src/Entities/GhastFireballEntity.h
@@ -20,15 +20,15 @@
class cGhastFireballEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cGhastFireballEntity)
- cGhastFireballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cGhastFireballEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected:
diff --git a/src/Entities/HangingEntity.cpp b/src/Entities/HangingEntity.cpp
index b3a50c91e..e69efdb73 100644
--- a/src/Entities/HangingEntity.cpp
+++ b/src/Entities/HangingEntity.cpp
@@ -9,8 +9,8 @@
-cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_Facing, double a_X, double a_Y, double a_Z) :
- cEntity(a_EntityType, a_X, a_Y, a_Z, 0.8, 0.8),
+cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_Facing, Vector3d a_Pos) :
+ super(a_EntityType, a_Pos, 0.8, 0.8),
m_Facing(cHangingEntity::BlockFaceToProtocolFace(a_Facing))
{
SetMaxHealth(1);
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h
index 35b0117b0..097ffeb0d 100644
--- a/src/Entities/HangingEntity.h
+++ b/src/Entities/HangingEntity.h
@@ -11,15 +11,15 @@
class cHangingEntity :
public cEntity
{
- typedef cEntity super;
+ // tolua_end
-public:
+ using super = cEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cHangingEntity)
- cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
+ cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, Vector3d a_Pos);
// tolua_begin
diff --git a/src/Entities/ItemFrame.cpp b/src/Entities/ItemFrame.cpp
index 72b910936..ac0dc3503 100644
--- a/src/Entities/ItemFrame.cpp
+++ b/src/Entities/ItemFrame.cpp
@@ -9,8 +9,8 @@
-cItemFrame::cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z) :
- cHangingEntity(etItemFrame, a_BlockFace, a_X, a_Y, a_Z),
+cItemFrame::cItemFrame(eBlockFace a_BlockFace, Vector3d a_Pos):
+ super(etItemFrame, a_BlockFace, a_Pos),
m_Item(E_BLOCK_AIR),
m_ItemRotation(0)
{
diff --git a/src/Entities/ItemFrame.h b/src/Entities/ItemFrame.h
index ff43e5ee1..7266ae88d 100644
--- a/src/Entities/ItemFrame.h
+++ b/src/Entities/ItemFrame.h
@@ -11,15 +11,15 @@
class cItemFrame :
public cHangingEntity
{
- typedef cHangingEntity super;
+ // tolua_end
-public:
+ using super = cHangingEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cItemFrame)
- cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
+ cItemFrame(eBlockFace a_BlockFace, Vector3d a_Pos);
// tolua_begin
diff --git a/src/Entities/LeashKnot.cpp b/src/Entities/LeashKnot.cpp
index 4002e11e3..82439e5cf 100644
--- a/src/Entities/LeashKnot.cpp
+++ b/src/Entities/LeashKnot.cpp
@@ -14,8 +14,8 @@
-cLeashKnot::cLeashKnot(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z) :
- cHangingEntity(etLeashKnot, a_BlockFace, a_X, a_Y, a_Z),
+cLeashKnot::cLeashKnot(eBlockFace a_BlockFace, Vector3d a_Pos) :
+ super(etLeashKnot, a_BlockFace, a_Pos),
m_ShouldSelfDestroy(false),
m_TicksToSelfDestroy(20 * 1)
{
diff --git a/src/Entities/LeashKnot.h b/src/Entities/LeashKnot.h
index 1a854ef34..685dbec5b 100644
--- a/src/Entities/LeashKnot.h
+++ b/src/Entities/LeashKnot.h
@@ -13,15 +13,14 @@ class cWorldInterface;
class cLeashKnot :
public cHangingEntity
{
- typedef cHangingEntity super;
-
-public:
-
// tolua_end
+ using super = cHangingEntity;
+
+public: // tolua_export
CLASS_PROTODEF(cLeashKnot)
- cLeashKnot(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
+ cLeashKnot(eBlockFace a_BlockFace, Vector3d a_Pos);
/** Looks for mobs leashed to a player and ties them to this knot */
void TiePlayersLeashedMobs(cPlayer & a_Player, bool a_ShouldBroadCast);
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 83fbe56de..9ff8c04b6 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -90,8 +90,11 @@ protected:
-cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
- super(etMinecart, a_X, a_Y, a_Z, 0.98, 0.7),
+////////////////////////////////////////////////////////////////////////////////
+// cMinecart:
+
+cMinecart::cMinecart(ePayload a_Payload, Vector3d a_Pos):
+ super(etMinecart, a_Pos, 0.98, 0.7),
m_Payload(a_Payload),
m_LastDamage(0),
m_DetectorRailPosition(0, 0, 0),
@@ -1164,8 +1167,8 @@ void cMinecart::Destroyed()
////////////////////////////////////////////////////////////////////////////////
// cRideableMinecart:
-cRideableMinecart::cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height) :
- super(mpNone, a_X, a_Y, a_Z),
+cRideableMinecart::cRideableMinecart(Vector3d a_Pos, const cItem & a_Content, int a_Height):
+ super(mpNone, a_Pos),
m_Content(a_Content),
m_Height(a_Height)
{
@@ -1209,8 +1212,8 @@ void cRideableMinecart::OnRightClicked(cPlayer & a_Player)
////////////////////////////////////////////////////////////////////////////////
// cMinecartWithChest:
-cMinecartWithChest::cMinecartWithChest(double a_X, double a_Y, double a_Z) :
- super(mpChest, a_X, a_Y, a_Z),
+cMinecartWithChest::cMinecartWithChest(Vector3d a_Pos):
+ super(mpChest, a_Pos),
cEntityWindowOwner(this),
m_Contents(ContentsWidth, ContentsHeight)
{
@@ -1283,8 +1286,8 @@ void cMinecartWithChest::Destroyed()
////////////////////////////////////////////////////////////////////////////////
// cMinecartWithFurnace:
-cMinecartWithFurnace::cMinecartWithFurnace(double a_X, double a_Y, double a_Z) :
- super(mpFurnace, a_X, a_Y, a_Z),
+cMinecartWithFurnace::cMinecartWithFurnace(Vector3d a_Pos):
+ super(mpFurnace, a_Pos),
m_FueledTimeLeft(-1),
m_IsFueled(false)
{
@@ -1350,8 +1353,8 @@ void cMinecartWithFurnace::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk
////////////////////////////////////////////////////////////////////////////////
// cMinecartWithTNT:
-cMinecartWithTNT::cMinecartWithTNT(double a_X, double a_Y, double a_Z) :
- super(mpTNT, a_X, a_Y, a_Z)
+cMinecartWithTNT::cMinecartWithTNT(Vector3d a_Pos):
+ super(mpTNT, a_Pos)
{
}
@@ -1364,8 +1367,8 @@ cMinecartWithTNT::cMinecartWithTNT(double a_X, double a_Y, double a_Z) :
////////////////////////////////////////////////////////////////////////////////
// cMinecartWithHopper:
-cMinecartWithHopper::cMinecartWithHopper(double a_X, double a_Y, double a_Z) :
- super(mpHopper, a_X, a_Y, a_Z)
+cMinecartWithHopper::cMinecartWithHopper(Vector3d a_Pos):
+ super(mpHopper, a_Pos)
{
}
diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h
index ef5b9e030..79624494c 100644
--- a/src/Entities/Minecart.h
+++ b/src/Entities/Minecart.h
@@ -20,7 +20,7 @@
class cMinecart :
public cEntity
{
- typedef cEntity super;
+ using super = cEntity;
public:
CLASS_PROTODEF(cMinecart)
@@ -45,7 +45,9 @@ public:
int LastDamage(void) const { return m_LastDamage; }
ePayload GetPayload(void) const { return m_Payload; }
+
protected:
+
ePayload m_Payload;
int m_LastDamage;
Vector3i m_DetectorRailPosition;
@@ -57,7 +59,7 @@ protected:
// Overwrite to enforce speed limit
virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override;
- cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
+ cMinecart(ePayload a_Payload, Vector3d a_Pos);
/** Handles physics on normal rails
For each tick, slow down on flat rails, speed up or slow down on ascending / descending rails (depending on direction), and turn on curved rails. */
@@ -95,19 +97,23 @@ protected:
class cRideableMinecart :
public cMinecart
{
- typedef cMinecart super;
+ using super = cMinecart;
public:
+
CLASS_PROTODEF(cRideableMinecart)
- cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height);
+ cRideableMinecart(Vector3d a_Pos, const cItem & a_Content, int a_Height);
const cItem & GetContent(void) const {return m_Content;}
int GetBlockHeight(void) const {return m_Height;}
+
// cEntity overrides:
virtual void OnRightClicked(cPlayer & a_Player) override;
+
protected:
+
cItem m_Content;
int m_Height;
} ;
@@ -121,12 +127,13 @@ class cMinecartWithChest :
public cItemGrid::cListener,
public cEntityWindowOwner
{
- typedef cMinecart super;
+ using super = cMinecart;
public:
+
CLASS_PROTODEF(cMinecartWithChest)
- cMinecartWithChest(double a_X, double a_Y, double a_Z);
+ cMinecartWithChest(Vector3d a_Pos);
enum
{
@@ -137,7 +144,9 @@ public:
const cItem & GetSlot(int a_Idx) const { return m_Contents.GetSlot(a_Idx); }
void SetSlot(int a_Idx, const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); }
+
protected:
+
cItemGrid m_Contents;
void OpenNewWindow(void);
virtual void Destroyed() override;
@@ -169,12 +178,13 @@ protected:
class cMinecartWithFurnace :
public cMinecart
{
- typedef cMinecart super;
+ using super = cMinecart;
public:
+
CLASS_PROTODEF(cMinecartWithFurnace)
- cMinecartWithFurnace(double a_X, double a_Y, double a_Z);
+ cMinecartWithFurnace(Vector3d a_Pos);
// cEntity overrides:
virtual void OnRightClicked(cPlayer & a_Player) override;
@@ -201,12 +211,12 @@ private:
class cMinecartWithTNT :
public cMinecart
{
- typedef cMinecart super;
+ using super = cMinecart;
public:
CLASS_PROTODEF(cMinecartWithTNT)
- cMinecartWithTNT(double a_X, double a_Y, double a_Z);
+ cMinecartWithTNT(Vector3d a_Pos);
} ;
@@ -216,10 +226,11 @@ public:
class cMinecartWithHopper :
public cMinecart
{
- typedef cMinecart super;
+ using super = cMinecart;
public:
+
CLASS_PROTODEF(cMinecartWithHopper)
- cMinecartWithHopper(double a_X, double a_Y, double a_Z);
+ cMinecartWithHopper(Vector3d a_Pos);
} ;
diff --git a/src/Entities/Painting.cpp b/src/Entities/Painting.cpp
index 5f7ab6245..a968356c4 100644
--- a/src/Entities/Painting.cpp
+++ b/src/Entities/Painting.cpp
@@ -10,8 +10,8 @@
-cPainting::cPainting(const AString & a_Name, eBlockFace a_Direction, double a_X, double a_Y, double a_Z)
- : cHangingEntity(etPainting, a_Direction, a_X, a_Y, a_Z),
+cPainting::cPainting(const AString & a_Name, eBlockFace a_Direction, Vector3d a_Pos):
+ super(etPainting, a_Direction, a_Pos),
m_Name(a_Name)
{
}
diff --git a/src/Entities/Painting.h b/src/Entities/Painting.h
index 20968d4f0..efe8a70cb 100644
--- a/src/Entities/Painting.h
+++ b/src/Entities/Painting.h
@@ -11,15 +11,15 @@
class cPainting :
public cHangingEntity
{
- typedef cHangingEntity super;
+ // tolua_end
-public:
+ using super = cHangingEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cPainting)
- cPainting(const AString & a_Name, eBlockFace a_Direction, double a_X, double a_Y, double a_Z);
+ cPainting(const AString & a_Name, eBlockFace a_Direction, Vector3d a_Pos);
/** Returns the protocol name of the painting */
const AString & GetName(void) const { return m_Name; } // tolua_export
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index 11c7999c9..dd218aec9 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -14,7 +14,7 @@
cPawn::cPawn(eEntityType a_EntityType, double a_Width, double a_Height) :
- super(a_EntityType, 0, 0, 0, a_Width, a_Height),
+ super(a_EntityType, Vector3d(), a_Width, a_Height),
m_EntityEffects(tEffectMap()),
m_LastGroundHeight(0),
m_bTouchGround(false)
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp
index c63c720c0..be64e9e2f 100644
--- a/src/Entities/Pickup.cpp
+++ b/src/Entities/Pickup.cpp
@@ -93,20 +93,23 @@ protected:
-cPickup::cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX, float a_SpeedY, float a_SpeedZ, int a_LifetimeTicks, bool a_CanCombine)
- : cEntity(etPickup, a_PosX, a_PosY, a_PosZ, 0.2, 0.2)
- , m_Timer(0)
- , m_Item(a_Item)
- , m_bCollected(false)
- , m_bIsPlayerCreated(IsPlayerCreated)
- , m_bCanCombine(a_CanCombine)
- , m_Lifetime(cTickTime(a_LifetimeTicks))
+////////////////////////////////////////////////////////////////////////////////
+// cPickup:
+
+cPickup::cPickup(Vector3d a_Pos, const cItem & a_Item, bool IsPlayerCreated, Vector3f a_Speed, int a_LifetimeTicks, bool a_CanCombine):
+ super(etPickup, a_Pos, 0.2, 0.2),
+ m_Timer(0),
+ m_Item(a_Item),
+ m_bCollected(false),
+ m_bIsPlayerCreated(IsPlayerCreated),
+ m_bCanCombine(a_CanCombine),
+ m_Lifetime(cTickTime(a_LifetimeTicks))
{
SetGravity(-16.0f);
SetAirDrag(0.02f);
SetMaxHealth(5);
SetHealth(5);
- SetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ);
+ SetSpeed(a_Speed);
}
diff --git a/src/Entities/Pickup.h b/src/Entities/Pickup.h
index 6b3d9f9f2..e1f3ed1a8 100644
--- a/src/Entities/Pickup.h
+++ b/src/Entities/Pickup.h
@@ -18,14 +18,15 @@ class cPlayer;
class cPickup :
public cEntity
{
- typedef cEntity super;
-
-public:
// tolua_end
+ using super = cEntity;
+
+public: // tolua_export
+
CLASS_PROTODEF(cPickup)
- cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f, int a_LifetimeTicks = 6000, bool a_CanCombine = true);
+ cPickup(Vector3d a_Pos, const cItem & a_Item, bool IsPlayerCreated, Vector3f a_Speed = Vector3f(), int a_LifetimeTicks = 6000, bool a_CanCombine = true);
cItem & GetItem(void) {return m_Item; } // tolua_export
const cItem & GetItem(void) const {return m_Item; }
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 4a5da0874..b2148fa2b 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -224,8 +224,8 @@ protected:
////////////////////////////////////////////////////////////////////////////////
// cProjectileEntity:
-cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height) :
- super(etProjectile, a_X, a_Y, a_Z, a_Width, a_Height),
+cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, double a_Width, double a_Height):
+ super(etProjectile, a_Pos, a_Width, a_Height),
m_ProjectileKind(a_Kind),
m_CreatorData(
((a_Creator != nullptr) ? a_Creator->GetUniqueID() : cEntity::INVALID_ID),
@@ -242,8 +242,8 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a
-cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height) :
- super(etProjectile, a_Pos.x, a_Pos.y, a_Pos.z, a_Width, a_Height),
+cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, double a_Width, double a_Height):
+ super(etProjectile, a_Pos, a_Width, a_Height),
m_ProjectileKind(a_Kind),
m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? static_cast<cPlayer *>(a_Creator)->GetName() : "", a_Creator->GetEquippedWeapon().m_Enchantments),
m_IsInGround(false)
@@ -259,7 +259,13 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Ve
-std::unique_ptr<cProjectileEntity> cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem * a_Item, const Vector3d * a_Speed)
+std::unique_ptr<cProjectileEntity> cProjectileEntity::Create(
+ eKind a_Kind,
+ cEntity * a_Creator,
+ Vector3d a_Pos,
+ const cItem * a_Item,
+ const Vector3d * a_Speed
+)
{
Vector3d Speed;
if (a_Speed != nullptr)
@@ -269,15 +275,15 @@ std::unique_ptr<cProjectileEntity> cProjectileEntity::Create(eKind a_Kind, cEnti
switch (a_Kind)
{
- case pkArrow: return cpp14::make_unique<cArrowEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
- case pkEgg: return cpp14::make_unique<cThrownEggEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
- case pkEnderPearl: return cpp14::make_unique<cThrownEnderPearlEntity>(a_Creator, a_X, a_Y, a_Z, Speed);
- case pkSnowball: return cpp14::make_unique<cThrownSnowballEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
- case pkGhastFireball: return cpp14::make_unique<cGhastFireballEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
- case pkFireCharge: return cpp14::make_unique<cFireChargeEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
- case pkExpBottle: return cpp14::make_unique<cExpBottleEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
- case pkSplashPotion: return cpp14::make_unique<cSplashPotionEntity> (a_Creator, a_X, a_Y, a_Z, Speed, *a_Item);
- case pkWitherSkull: return cpp14::make_unique<cWitherSkullEntity> (a_Creator, a_X, a_Y, a_Z, Speed);
+ case pkArrow: return cpp14::make_unique<cArrowEntity> (a_Creator, a_Pos, Speed);
+ case pkEgg: return cpp14::make_unique<cThrownEggEntity> (a_Creator, a_Pos, Speed);
+ case pkEnderPearl: return cpp14::make_unique<cThrownEnderPearlEntity>(a_Creator, a_Pos, Speed);
+ case pkSnowball: return cpp14::make_unique<cThrownSnowballEntity> (a_Creator, a_Pos, Speed);
+ case pkGhastFireball: return cpp14::make_unique<cGhastFireballEntity> (a_Creator, a_Pos, Speed);
+ case pkFireCharge: return cpp14::make_unique<cFireChargeEntity> (a_Creator, a_Pos, Speed);
+ case pkExpBottle: return cpp14::make_unique<cExpBottleEntity> (a_Creator, a_Pos, Speed);
+ case pkSplashPotion: return cpp14::make_unique<cSplashPotionEntity> (a_Creator, a_Pos, Speed, *a_Item);
+ case pkWitherSkull: return cpp14::make_unique<cWitherSkullEntity> (a_Creator, a_Pos, Speed);
case pkFirework:
{
ASSERT(a_Item != nullptr);
@@ -286,7 +292,7 @@ std::unique_ptr<cProjectileEntity> cProjectileEntity::Create(eKind a_Kind, cEnti
return nullptr;
}
- return cpp14::make_unique<cFireworkEntity>(a_Creator, a_X, a_Y, a_Z, *a_Item);
+ return cpp14::make_unique<cFireworkEntity>(a_Creator, a_Pos, *a_Item);
}
case pkFishingFloat: break;
}
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<cProjectileEntity> 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<cProjectileEntity> 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<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
+ )
+ {
+ 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);
diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp
index d5042f072..15a0c3c9a 100644
--- a/src/Entities/SplashPotionEntity.cpp
+++ b/src/Entities/SplashPotionEntity.cpp
@@ -21,11 +21,11 @@
cSplashPotionEntity::cSplashPotionEntity(
cEntity * a_Creator,
- double a_X, double a_Y, double a_Z,
- const Vector3d & a_Speed,
+ Vector3d a_Pos,
+ Vector3d a_Speed,
const cItem & a_Item
-) :
- super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
+):
+ super(pkSplashPotion, a_Creator, a_Pos, 0.25, 0.25),
m_Item(a_Item),
m_DestroyTimer(-1)
{
diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h
index bb78bfaeb..b90d0a317 100644
--- a/src/Entities/SplashPotionEntity.h
+++ b/src/Entities/SplashPotionEntity.h
@@ -24,18 +24,18 @@ class cEntity;
class cSplashPotionEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cSplashPotionEntity)
cSplashPotionEntity(
cEntity * a_Creator,
- double a_X, double a_Y, double a_Z,
- const Vector3d & a_Speed,
+ Vector3d a_Pos,
+ Vector3d a_Speed,
const cItem & a_Item
);
diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp
index 640684ace..c76b09119 100644
--- a/src/Entities/TNTEntity.cpp
+++ b/src/Entities/TNTEntity.cpp
@@ -9,7 +9,7 @@
cTNTEntity::cTNTEntity(Vector3d a_Pos, int a_FuseTicks) :
- super(etTNT, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98),
+ super(etTNT, a_Pos, 0.98, 0.98),
m_FuseTicks(a_FuseTicks)
{
SetGravity(-16.0f);
diff --git a/src/Entities/ThrownEggEntity.cpp b/src/Entities/ThrownEggEntity.cpp
index 226f37fb6..14832beed 100644
--- a/src/Entities/ThrownEggEntity.cpp
+++ b/src/Entities/ThrownEggEntity.cpp
@@ -7,8 +7,8 @@
-cThrownEggEntity::cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkEgg, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
+cThrownEggEntity::cThrownEggEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkEgg, a_Creator, a_Pos, 0.25, 0.25),
m_DestroyTimer(-1)
{
SetSpeed(a_Speed);
diff --git a/src/Entities/ThrownEggEntity.h b/src/Entities/ThrownEggEntity.h
index 071b974cb..d49153d49 100644
--- a/src/Entities/ThrownEggEntity.h
+++ b/src/Entities/ThrownEggEntity.h
@@ -20,15 +20,15 @@
class cThrownEggEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cThrownEggEntity)
- cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cThrownEggEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected:
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index ca362d3bd..8cc266ef6 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -8,8 +8,8 @@
-cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkEnderPearl, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
+cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkEnderPearl, a_Creator, a_Pos, 0.25, 0.25),
m_DestroyTimer(-1)
{
SetSpeed(a_Speed);
diff --git a/src/Entities/ThrownEnderPearlEntity.h b/src/Entities/ThrownEnderPearlEntity.h
index ee618f900..ad1761f8e 100644
--- a/src/Entities/ThrownEnderPearlEntity.h
+++ b/src/Entities/ThrownEnderPearlEntity.h
@@ -20,15 +20,15 @@
class cThrownEnderPearlEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cThrownEnderPearlEntity)
- cThrownEnderPearlEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cThrownEnderPearlEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected:
diff --git a/src/Entities/ThrownSnowballEntity.cpp b/src/Entities/ThrownSnowballEntity.cpp
index 8a6426ca9..5dadcc15e 100644
--- a/src/Entities/ThrownSnowballEntity.cpp
+++ b/src/Entities/ThrownSnowballEntity.cpp
@@ -7,8 +7,8 @@
-cThrownSnowballEntity::cThrownSnowballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkSnowball, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
+cThrownSnowballEntity::cThrownSnowballEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkSnowball, a_Creator, a_Pos, 0.25, 0.25),
m_DestroyTimer(-1)
{
SetSpeed(a_Speed);
diff --git a/src/Entities/ThrownSnowballEntity.h b/src/Entities/ThrownSnowballEntity.h
index 7bed78df3..79010071b 100644
--- a/src/Entities/ThrownSnowballEntity.h
+++ b/src/Entities/ThrownSnowballEntity.h
@@ -20,15 +20,15 @@
class cThrownSnowballEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cThrownSnowballEntity)
- cThrownSnowballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cThrownSnowballEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected:
diff --git a/src/Entities/WitherSkullEntity.cpp b/src/Entities/WitherSkullEntity.cpp
index 354a08dc6..65e055e59 100644
--- a/src/Entities/WitherSkullEntity.cpp
+++ b/src/Entities/WitherSkullEntity.cpp
@@ -12,8 +12,8 @@
-cWitherSkullEntity::cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed) :
- super(pkWitherSkull, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25)
+cWitherSkullEntity::cWitherSkullEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+ super(pkWitherSkull, a_Creator, a_Pos, 0.25, 0.25)
{
SetSpeed(a_Speed);
SetGravity(0);
diff --git a/src/Entities/WitherSkullEntity.h b/src/Entities/WitherSkullEntity.h
index af9b31625..f70b71bf5 100644
--- a/src/Entities/WitherSkullEntity.h
+++ b/src/Entities/WitherSkullEntity.h
@@ -20,15 +20,15 @@
class cWitherSkullEntity :
public cProjectileEntity
{
- typedef cProjectileEntity super;
+ // tolua_end
-public:
+ using super = cProjectileEntity;
- // tolua_end
+public: // tolua_export
CLASS_PROTODEF(cWitherSkullEntity)
- cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
+ cWitherSkullEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed);
protected: