summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/ArrowEntity.h45
-rw-r--r--src/Entities/ExpBottleEntity.h17
-rw-r--r--src/Entities/FireChargeEntity.h15
-rw-r--r--src/Entities/FireworkEntity.cpp13
-rw-r--r--src/Entities/FireworkEntity.h32
-rw-r--r--src/Entities/GhastFireballEntity.h15
-rw-r--r--src/Entities/HangingEntity.cpp30
-rw-r--r--src/Entities/HangingEntity.h29
-rw-r--r--src/Entities/ItemFrame.cpp16
-rw-r--r--src/Entities/ItemFrame.h17
-rw-r--r--src/Entities/Painting.h13
-rw-r--r--src/Entities/Pickup.h10
-rw-r--r--src/Entities/ProjectileEntity.h20
-rw-r--r--src/Entities/SplashPotionEntity.h18
-rw-r--r--src/Entities/ThrownEggEntity.cpp21
-rw-r--r--src/Entities/ThrownEggEntity.h34
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp22
-rw-r--r--src/Entities/ThrownEnderPearlEntity.h34
-rw-r--r--src/Entities/ThrownSnowballEntity.cpp25
-rw-r--r--src/Entities/ThrownSnowballEntity.h34
-rw-r--r--src/Entities/WitherSkullEntity.h12
21 files changed, 311 insertions, 161 deletions
diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h
index 1e4d8eebb..436ec0293 100644
--- a/src/Entities/ArrowEntity.h
+++ b/src/Entities/ArrowEntity.h
@@ -1,6 +1,11 @@
-//
-// ArrowEntity.h
-//
+
+// ArrowEntity.h
+
+// Declares the cArrowEntity representing the arrow that has been shot by the player or by a skeleton
+
+
+
+
#pragma once
@@ -19,7 +24,7 @@ class cArrowEntity :
typedef cProjectileEntity super;
public:
- /// Determines when the arrow can be picked up (depending on player gamemode). Corresponds to the MCA file "pickup" field
+ /** Determines when the arrow can be picked up (depending on player gamemode). Corresponds to the MCA file "pickup" field */
enum ePickupState
{
psNoPickup = 0,
@@ -31,33 +36,33 @@ public:
CLASS_PROTODEF(cArrowEntity)
- /// Creates a new arrow with psNoPickup state and default damage modifier coeff
+ /** 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);
- /// Creates a new arrow as shot by a player, initializes it from the player object
+ /** Creates a new arrow as shot by a player, initializes it from the player object */
cArrowEntity(cPlayer & a_Player, double a_Force);
// tolua_begin
- /// Returns whether the arrow can be picked up by players
+ /** Returns whether the arrow can be picked up by players */
ePickupState GetPickupState(void) const { return m_PickupState; }
- /// Sets a new pickup state
+ /** Sets a new pickup state */
void SetPickupState(ePickupState a_PickupState) { m_PickupState = a_PickupState; }
- /// Returns the damage modifier coeff.
+ /** Returns the damage modifier coeff. */
double GetDamageCoeff(void) const { return m_DamageCoeff; }
- /// Sets the damage modifier coeff
+ /** Sets the damage modifier coeff */
void SetDamageCoeff(double a_DamageCoeff) { m_DamageCoeff = a_DamageCoeff; }
- /// Returns true if the specified player can pick the arrow up
+ /** Returns true if the specified player can pick the arrow up */
bool CanPickup(const cPlayer & a_Player) const;
- /// Returns true if the arrow is set as critical
+ /** Returns true if the arrow is set as critical */
bool IsCritical(void) const { return m_IsCritical; }
- /// Sets the IsCritical flag
+ /** Sets the IsCritical flag */
void SetIsCritical(bool a_IsCritical) { m_IsCritical = a_IsCritical; }
/** Gets the block arrow is in */
@@ -70,28 +75,28 @@ public:
protected:
- /// Determines when the arrow can be picked up by players
+ /** Determines when the arrow can be picked up by players */
ePickupState m_PickupState;
- /// The coefficient applied to the damage that the arrow will deal, based on the bow enchantment. 2.0 for normal arrow
+ /** The coefficient applied to the damage that the arrow will deal, based on the bow enchantment. 2.0 for normal arrow */
double m_DamageCoeff;
- /// If true, the arrow deals more damage
+ /** If true, the arrow deals more damage */
bool m_IsCritical;
- /// Timer for pickup collection animation or five minute timeout
+ /** Timer for pickup collection animation or five minute timeout */
float m_Timer;
- /// Timer for client arrow position confirmation via TeleportEntity
+ /** Timer for client arrow position confirmation via TeleportEntity */
float m_HitGroundTimer;
// Whether the arrow has already been teleported into the proper position in the ground.
bool m_HasTeleported;
- /// If true, the arrow is in the process of being collected - don't go to anyone else
+ /** If true, the arrow is in the process of being collected - don't go to anyone else */
bool m_bIsCollected;
- /// Stores the block position that arrow is lodged into, sets m_IsInGround to false if it becomes air
+ /** Stores the block position that arrow is lodged into, sets m_IsInGround to false if it becomes air */
Vector3i m_HitBlockPos;
// cProjectileEntity overrides:
diff --git a/src/Entities/ExpBottleEntity.h b/src/Entities/ExpBottleEntity.h
index d36110f97..715b9947e 100644
--- a/src/Entities/ExpBottleEntity.h
+++ b/src/Entities/ExpBottleEntity.h
@@ -1,6 +1,11 @@
-//
-// ExpBottleEntity.h
-//
+
+// ExpBottleEntity.h
+
+// Declares the cExpBottleEntity class representing the thrown exp bottle
+
+
+
+
#pragma once
@@ -33,6 +38,10 @@ protected:
/** Breaks the bottle, fires its particle effects and sounds
@param a_HitPos The position where the bottle will break */
- void Break(const Vector3d &a_HitPos);
+ void Break(const Vector3d & a_HitPos);
}; // tolua_export
+
+
+
+
diff --git a/src/Entities/FireChargeEntity.h b/src/Entities/FireChargeEntity.h
index 5df55bec4..eb08f5324 100644
--- a/src/Entities/FireChargeEntity.h
+++ b/src/Entities/FireChargeEntity.h
@@ -1,6 +1,11 @@
-//
-// FireChargeEntity.h
-//
+
+// FireChargeEntity.h
+
+// Declares the cFireChargeEntity representing the fire charge shot by the blaze
+
+
+
+
#pragma once
@@ -34,3 +39,7 @@ protected:
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
} ; // tolua_export
+
+
+
+
diff --git a/src/Entities/FireworkEntity.cpp b/src/Entities/FireworkEntity.cpp
index 403a53c84..68d02640a 100644
--- a/src/Entities/FireworkEntity.cpp
+++ b/src/Entities/FireworkEntity.cpp
@@ -10,7 +10,7 @@
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),
- m_ExplodeTimer(0),
+ m_TicksToExplosion(a_Item.m_FireworkItem.m_FlightTimeInTicks),
m_FireworkItem(a_Item)
{
}
@@ -27,7 +27,9 @@ void cFireworkEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if ((PosY < 0) || (PosY >= cChunkDef::Height))
{
- goto setspeed;
+ AddSpeedY(1);
+ AddPosition(GetSpeed() * (a_Dt / 1000));
+ return;
}
if (m_IsInGround)
@@ -50,7 +52,6 @@ void cFireworkEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
}
}
-setspeed:
AddSpeedY(1);
AddPosition(GetSpeed() * (a_Dt / 1000));
}
@@ -63,11 +64,13 @@ void cFireworkEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
- if (m_ExplodeTimer == m_FireworkItem.m_FireworkItem.m_FlightTimeInTicks)
+ if (m_TicksToExplosion <= 0)
{
+ // TODO: Notify the plugins
m_World->BroadcastEntityStatus(*this, esFireworkExploding);
Destroy();
+ return;
}
- m_ExplodeTimer++;
+ m_TicksToExplosion -= 1;
}
diff --git a/src/Entities/FireworkEntity.h b/src/Entities/FireworkEntity.h
index 20f18b6dc..300ec571e 100644
--- a/src/Entities/FireworkEntity.h
+++ b/src/Entities/FireworkEntity.h
@@ -1,6 +1,11 @@
-//
-// FireworkEntity.h
-//
+
+// FireworkEntity.h
+
+// Declares the cFireworkEntity class representing the flying firework rocket
+
+
+
+
#pragma once
@@ -24,7 +29,22 @@ public:
CLASS_PROTODEF(cFireworkEntity)
cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item);
+
+ // tolua_begin
+
+ /** Returns the item used to create the rocket (has all the firework effects on it) */
const cItem & GetItem(void) const { return m_FireworkItem; }
+
+ /** Sets the item that is used to create the rocket (has all the firework effects on it) */
+ void SetItem(const cItem & a_Item) { m_FireworkItem = a_Item; }
+
+ /** Returns the number of ticks left until the firework explosion. */
+ int GetTicksToExplosion(void) const { return m_TicksToExplosion; }
+
+ /** Sets the number of ticks left until the firework explosion. */
+ void SetTicksToExplosion(int a_TicksToExplosion) { m_TicksToExplosion = a_TicksToExplosion; }
+
+ // tolua_end
protected:
@@ -34,7 +54,11 @@ protected:
private:
- int m_ExplodeTimer;
+ int m_TicksToExplosion;
cItem m_FireworkItem;
}; // tolua_export
+
+
+
+
diff --git a/src/Entities/GhastFireballEntity.h b/src/Entities/GhastFireballEntity.h
index 3ed72d9ef..bbce89d31 100644
--- a/src/Entities/GhastFireballEntity.h
+++ b/src/Entities/GhastFireballEntity.h
@@ -1,6 +1,11 @@
-//
-// GhastFireballEntity.h
-//
+
+// GhastFireballEntity.h
+
+// Declares the cGhastFireballEntity class representing the ghast fireball in flight.
+
+
+
+
#pragma once
@@ -36,3 +41,7 @@ protected:
// TODO: Deflecting the fireballs by arrow- or sword- hits
} ; // tolua_export
+
+
+
+
diff --git a/src/Entities/HangingEntity.cpp b/src/Entities/HangingEntity.cpp
index 3276bc4a0..a6b9c40c8 100644
--- a/src/Entities/HangingEntity.cpp
+++ b/src/Entities/HangingEntity.cpp
@@ -9,9 +9,9 @@
-cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z)
- : cEntity(a_EntityType, a_X, a_Y, a_Z, 0.8, 0.8)
- , m_BlockFace(a_BlockFace)
+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),
+ m_Facing(a_Facing)
{
SetMaxHealth(1);
SetHealth(1);
@@ -21,15 +21,23 @@ cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace,
-void cHangingEntity::SetDirection(eBlockFace a_BlockFace)
+void cHangingEntity::SetFacing(eBlockFace a_Facing)
{
- if ((a_BlockFace < 2) || (a_BlockFace > 5))
+ // Y-based faces are not allowed:
+ switch (a_Facing)
{
- ASSERT(!"Tried to set a bad direction!");
- return;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ LOGWARNING("%s: Invalid facing: %d. Ignoring.", __FUNCTION__, a_Facing);
+ ASSERT(!"Tried to set a bad facing!");
+ return;
+ }
+ default: break;
}
- m_BlockFace = a_BlockFace;
+ m_Facing = a_Facing;
}
@@ -41,7 +49,7 @@ void cHangingEntity::SpawnOn(cClientHandle & a_ClientHandle)
int Dir = 0;
// The client uses different values for item frame directions and block faces. Our constants are for the block faces, so we convert them here to item frame faces
- switch (m_BlockFace)
+ switch (m_Facing)
{
case BLOCK_FACE_ZP: Dir = 0; break;
case BLOCK_FACE_ZM: Dir = 2; break;
@@ -49,8 +57,8 @@ void cHangingEntity::SpawnOn(cClientHandle & a_ClientHandle)
case BLOCK_FACE_XP: Dir = 3; break;
default:
{
- LOGINFO("Invalid face (%d) in a cHangingEntity at {%d, %d, %d}, adjusting to BLOCK_FACE_XP.",
- m_BlockFace, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ()
+ LOGINFO("Invalid facing (%d) in a cHangingEntity at {%d, %d, %d}, adjusting to BLOCK_FACE_XP.",
+ m_Facing, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ()
);
Dir = 3;
}
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h
index 1cc0034e1..67146a20b 100644
--- a/src/Entities/HangingEntity.h
+++ b/src/Entities/HangingEntity.h
@@ -11,36 +11,41 @@
class cHangingEntity :
public cEntity
{
- // tolua_end
typedef cEntity super;
public:
+ // tolua_end
+
CLASS_PROTODEF(cHangingEntity)
cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
- /** Returns the orientation from the hanging entity */
- eBlockFace GetDirection() const { return m_BlockFace; } // tolua_export
+ // tolua_begin
+
+ /** Returns the direction in which the entity is facing. */
+ eBlockFace GetFacing() const { return m_Facing; }
- /** Set the orientation from the hanging entity */
- void SetDirection(eBlockFace a_BlockFace); // tolua_export
+ /** Set the direction in which the entity is facing. */
+ void SetFacing(eBlockFace a_Facing);
- /** Returns the X coord. */
- int GetTileX() const { return POSX_TOINT; } // tolua_export
+ /** Returns the X coord of the block in which the entity resides. */
+ int GetBlockX() const { return POSX_TOINT; }
- /** Returns the Y coord. */
- int GetTileY() const { return POSY_TOINT; } // tolua_export
+ /** Returns the Y coord of the block in which the entity resides. */
+ int GetBlockY() const { return POSY_TOINT; }
- /** Returns the Z coord. */
- int GetTileZ() const { return POSZ_TOINT; } // tolua_export
+ /** Returns the Z coord of the block in which the entity resides. */
+ int GetBlockZ() const { return POSZ_TOINT; }
+
+ // tolua_end
private:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(float a_Dt, cChunk & a_Chunk) override {}
- eBlockFace m_BlockFace;
+ eBlockFace m_Facing;
}; // tolua_export
diff --git a/src/Entities/ItemFrame.cpp b/src/Entities/ItemFrame.cpp
index b7aac52d0..dfffcd3ed 100644
--- a/src/Entities/ItemFrame.cpp
+++ b/src/Entities/ItemFrame.cpp
@@ -9,10 +9,10 @@
-cItemFrame::cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z)
- : cHangingEntity(etItemFrame, a_BlockFace, a_X, a_Y, a_Z)
- , m_Item(E_BLOCK_AIR)
- , m_Rotation(0)
+cItemFrame::cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z) :
+ cHangingEntity(etItemFrame, a_BlockFace, a_X, a_Y, a_Z),
+ m_Item(E_BLOCK_AIR),
+ m_ItemRotation(0)
{
}
@@ -27,10 +27,10 @@ void cItemFrame::OnRightClicked(cPlayer & a_Player)
if (!m_Item.IsEmpty())
{
// Item not empty, rotate, clipping values to zero to three inclusive
- m_Rotation++;
- if (m_Rotation >= 8)
+ m_ItemRotation++;
+ if (m_ItemRotation >= 8)
{
- m_Rotation = 0;
+ m_ItemRotation = 0;
}
}
else if (!a_Player.GetEquippedItem().IsEmpty())
@@ -72,7 +72,7 @@ void cItemFrame::KilledBy(TakeDamageInfo & a_TDI)
SetHealth(GetMaxHealth());
m_Item.Empty();
- m_Rotation = 0;
+ m_ItemRotation = 0;
SetInvulnerableTicks(0);
GetWorld()->BroadcastEntityMetadata(*this);
}
diff --git a/src/Entities/ItemFrame.h b/src/Entities/ItemFrame.h
index a63b78b70..ced8c37af 100644
--- a/src/Entities/ItemFrame.h
+++ b/src/Entities/ItemFrame.h
@@ -11,26 +11,31 @@
class cItemFrame :
public cHangingEntity
{
- // tolua_end
typedef cHangingEntity super;
public:
+ // tolua_end
+
CLASS_PROTODEF(cItemFrame)
cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
+ // tolua_begin
+
/** Returns the item in the frame */
- const cItem & GetItem(void) { return m_Item; } // tolua_export
+ const cItem & GetItem(void) { return m_Item; }
/** Set the item in the frame */
- void SetItem(cItem & a_Item) { m_Item = a_Item; } // tolua_export
+ void SetItem(cItem & a_Item) { m_Item = a_Item; }
/** Returns the rotation from the item in the frame */
- Byte GetRotation(void) const { return m_Rotation; } // tolua_export
+ Byte GetItemRotation(void) const { return m_ItemRotation; }
/** Set the rotation from the item in the frame */
- void SetRotation(Byte a_Rotation) { m_Rotation = a_Rotation; } // tolua_export
+ void SetItemRotation(Byte a_ItemRotation) { m_ItemRotation = a_ItemRotation; }
+
+ // tolua_end
private:
@@ -39,7 +44,7 @@ private:
virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) override;
cItem m_Item;
- Byte m_Rotation;
+ Byte m_ItemRotation;
}; // tolua_export
diff --git a/src/Entities/Painting.h b/src/Entities/Painting.h
index 9877c95c5..078270b42 100644
--- a/src/Entities/Painting.h
+++ b/src/Entities/Painting.h
@@ -11,15 +11,22 @@
class cPainting :
public cEntity
{
- // tolua_end
typedef cEntity super;
public:
+
+ // tolua_end
+
CLASS_PROTODEF(cPainting)
cPainting(const AString & a_Name, int a_Direction, double a_X, double a_Y, double a_Z);
- const AString & GetName(void) const { return m_Name; } // tolua_export
- int GetDirection(void) const { return m_Direction; } // tolua_export
+
+ // tolua_begin
+
+ const AString & GetName(void) const { return m_Name; }
+ int GetDirection(void) const { return m_Direction; }
+
+ // tolua_end
private:
diff --git a/src/Entities/Pickup.h b/src/Entities/Pickup.h
index b3cbeee0b..d1176a7cf 100644
--- a/src/Entities/Pickup.h
+++ b/src/Entities/Pickup.h
@@ -19,7 +19,7 @@ class cPickup :
public cEntity
{
typedef cEntity super;
-
+
public:
// tolua_end
@@ -37,10 +37,10 @@ public:
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
/** Returns the number of ticks that this entity has existed */
- int GetAge(void) const { return (int)(m_Timer / 50); } // tolua_export
+ int GetAge(void) const { return static_cast<int>(m_Timer / 50); } // tolua_export
/** Set the number of ticks that this entity has existed */
- void SetAge(int a_Age) { m_Timer = (float)(a_Age * 50); } // tolua_export
+ void SetAge(int a_Age) { m_Timer = static_cast<float>(a_Age * 50); } // tolua_export
/** Returns true if the pickup has already been collected */
bool IsCollected(void) const { return m_bCollected; } // tolua_export
@@ -59,7 +59,3 @@ private:
bool m_bIsPlayerCreated;
}; // tolua_export
-
-
-
-
diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h
index 3861f9ecc..2a98e31c7 100644
--- a/src/Entities/ProjectileEntity.h
+++ b/src/Entities/ProjectileEntity.h
@@ -1,7 +1,7 @@
// ProjectileEntity.h
-// Declares the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types
+// Declares the cProjectileEntity class representing the common base class for projectiles
@@ -23,7 +23,7 @@ class cProjectileEntity :
typedef cEntity super;
public:
- /// The kind of the projectile. The numbers correspond to the network type ID used for spawning via the 0x17 packet.
+ /** The kind of the projectile. The numbers correspond to the network type ID used for spawning them in the protocol. */
enum eKind
{
pkArrow = 60,
@@ -48,22 +48,22 @@ public:
static 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);
- /// Called by the physics blocktracer when the entity hits a solid block, the hit position and the face hit (BLOCK_FACE_) is given
+ /** 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(const Vector3d & a_HitPos, eBlockFace a_HitFace);
- /// Called by the physics blocktracer when the entity hits another entity
+ /** Called by the physics blocktracer when the entity hits another entity */
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
UNUSED(a_EntityHit);
UNUSED(a_HitPos);
}
- /// Called by Chunk when the projectile is eligible for player collection
+ /** Called by Chunk when the projectile is eligible for player collection */
virtual void CollectedBy(cPlayer & a_Dest);
// tolua_begin
- /// Returns the kind of the projectile (fast class identification)
+ /** Returns the kind of the projectile (fast class identification) */
eKind GetProjectileKind(void) const { return m_ProjectileKind; }
/** Returns the unique ID of the entity who created this projectile
@@ -76,15 +76,15 @@ public:
*/
AString GetCreatorName(void) const { return m_CreatorData.m_Name; }
- /// Returns the string that is used as the entity type (class name) in MCA files
+ /** Returns the string that is used as the entity type (class name) in MCA files */
AString GetMCAClassName(void) const;
- /// Returns true if the projectile has hit the ground and is stuck there
+ /** Returns true if the projectile has hit the ground and is stuck there */
bool IsInGround(void) const { return m_IsInGround; }
// tolua_end
- /// Sets the internal InGround flag. To be used by MCA loader only!
+ /** Sets the internal InGround flag. To be used by MCA loader only! */
void SetIsInGround(bool a_IsInGround) { m_IsInGround = a_IsInGround; }
protected:
@@ -114,7 +114,7 @@ protected:
*/
CreatorData m_CreatorData;
- /// True if the projectile has hit the ground and is stuck there
+ /** True if the projectile has hit the ground and is stuck there */
bool m_IsInGround;
// cEntity overrides:
diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h
index 4afc5f204..9302d8292 100644
--- a/src/Entities/SplashPotionEntity.h
+++ b/src/Entities/SplashPotionEntity.h
@@ -1,6 +1,11 @@
-//
-// SplashPotionEntity.h
-//
+
+// SplashPotionEntity.h
+
+// Declares the cSplashPotionEntity class representing a splash potion that has been thrown
+
+
+
+
#pragma once
@@ -32,6 +37,7 @@ public:
const cItem & a_Item
);
+ // tolua_begin
cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; }
cEntityEffect GetEntityEffect(void) const { return m_EntityEffect; }
int GetPotionColor(void) const { return m_PotionColor; }
@@ -39,6 +45,8 @@ public:
void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; }
void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; }
void SetPotionColor(int a_PotionColor) { m_PotionColor = a_PotionColor; }
+
+ // tolua_end
protected:
@@ -77,3 +85,7 @@ private:
/** Time in ticks to wait for the hit animation to begin before destroying */
int m_DestroyTimer;
} ; // tolua_export
+
+
+
+
diff --git a/src/Entities/ThrownEggEntity.cpp b/src/Entities/ThrownEggEntity.cpp
index 5ae85bee8..24c946a9c 100644
--- a/src/Entities/ThrownEggEntity.cpp
+++ b/src/Entities/ThrownEggEntity.cpp
@@ -44,6 +44,27 @@ void cThrownEggEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_Hit
+void cThrownEggEntity::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ if (m_DestroyTimer > 0)
+ {
+ m_DestroyTimer--;
+ if (m_DestroyTimer == 0)
+ {
+ Destroy();
+ return;
+ }
+ }
+ else
+ {
+ super::Tick(a_Dt, a_Chunk);
+ }
+}
+
+
+
+
+
void cThrownEggEntity::TrySpawnChicken(const Vector3d & a_HitPos)
{
if (m_World->GetTickRandomNumber(7) == 1)
diff --git a/src/Entities/ThrownEggEntity.h b/src/Entities/ThrownEggEntity.h
index a0b7d5340..6ffedf5b5 100644
--- a/src/Entities/ThrownEggEntity.h
+++ b/src/Entities/ThrownEggEntity.h
@@ -1,6 +1,11 @@
-//
-// ThrownEggEntity.h
-//
+
+// ThrownEggEntity.h
+
+// Declares the cThrownEggEntity class representing a regular thrown egg
+
+
+
+
#pragma once
@@ -29,23 +34,8 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
- virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
- virtual void Tick (float a_Dt, cChunk & a_Chunk) override
- {
- if (m_DestroyTimer > 0)
- {
- m_DestroyTimer--;
- if (m_DestroyTimer == 0)
- {
- Destroy();
- return;
- }
- }
- else
- {
- super::Tick(a_Dt, a_Chunk);
- }
- }
+ virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
// Randomly decides whether to spawn a chicken where the egg lands.
void TrySpawnChicken(const Vector3d & a_HitPos);
@@ -56,3 +46,7 @@ private:
int m_DestroyTimer;
} ; // tolua_export
+
+
+
+
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index c7407e6ae..8f1b62934 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -1,3 +1,4 @@
+
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "ThrownEnderPearlEntity.h"
@@ -45,6 +46,27 @@ void cThrownEnderPearlEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d
+void cThrownEnderPearlEntity::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ if (m_DestroyTimer > 0)
+ {
+ m_DestroyTimer--;
+ if (m_DestroyTimer == 0)
+ {
+ Destroy();
+ return;
+ }
+ }
+ else
+ {
+ super::Tick(a_Dt, a_Chunk);
+ }
+}
+
+
+
+
+
void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
{
if (m_CreatorData.m_Name.empty())
diff --git a/src/Entities/ThrownEnderPearlEntity.h b/src/Entities/ThrownEnderPearlEntity.h
index 436450013..475ebde87 100644
--- a/src/Entities/ThrownEnderPearlEntity.h
+++ b/src/Entities/ThrownEnderPearlEntity.h
@@ -1,6 +1,11 @@
-//
-// ThrownEnderPearlEntity.h
-//
+
+// ThrownEnderPearlEntity.h
+
+// Declares the cThrownEnderPeralEntity class representing an ender pearl being thrown
+
+
+
+
#pragma once
@@ -29,23 +34,8 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
- virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
- virtual void Tick (float a_Dt, cChunk & a_Chunk) override
- {
- if (m_DestroyTimer > 0)
- {
- m_DestroyTimer--;
- if (m_DestroyTimer == 0)
- {
- Destroy();
- return;
- }
- }
- else
- {
- super::Tick(a_Dt, a_Chunk);
- }
- }
+ virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
/** Teleports the creator where the ender pearl lands */
void TeleportCreator(const Vector3d & a_HitPos);
@@ -56,3 +46,7 @@ private:
int m_DestroyTimer;
} ; // tolua_export
+
+
+
+
diff --git a/src/Entities/ThrownSnowballEntity.cpp b/src/Entities/ThrownSnowballEntity.cpp
index 496397100..88e39d22e 100644
--- a/src/Entities/ThrownSnowballEntity.cpp
+++ b/src/Entities/ThrownSnowballEntity.cpp
@@ -43,3 +43,28 @@ void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d &
m_DestroyTimer = 5;
}
+
+
+
+
+
+void cThrownSnowballEntity::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ if (m_DestroyTimer > 0)
+ {
+ m_DestroyTimer--;
+ if (m_DestroyTimer == 0)
+ {
+ Destroy();
+ return;
+ }
+ }
+ else
+ {
+ super::Tick(a_Dt, a_Chunk);
+ }
+}
+
+
+
+
diff --git a/src/Entities/ThrownSnowballEntity.h b/src/Entities/ThrownSnowballEntity.h
index 8d195ced1..f806996cc 100644
--- a/src/Entities/ThrownSnowballEntity.h
+++ b/src/Entities/ThrownSnowballEntity.h
@@ -1,6 +1,11 @@
-//
-// ThrownSnowballEntity.h
-//
+
+// ThrownSnowballEntity.h
+
+// Declares the cThrownSnowballEntity representing a snowball that has been thrown
+
+
+
+
#pragma once
@@ -29,23 +34,8 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
- virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
- virtual void Tick (float a_Dt, cChunk & a_Chunk) override
- {
- if (m_DestroyTimer > 0)
- {
- m_DestroyTimer--;
- if (m_DestroyTimer == 0)
- {
- Destroy();
- return;
- }
- }
- else
- {
- super::Tick(a_Dt, a_Chunk);
- }
- }
+ virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
private:
@@ -53,3 +43,7 @@ private:
int m_DestroyTimer;
} ; // tolua_export
+
+
+
+
diff --git a/src/Entities/WitherSkullEntity.h b/src/Entities/WitherSkullEntity.h
index c59acd807..43a520388 100644
--- a/src/Entities/WitherSkullEntity.h
+++ b/src/Entities/WitherSkullEntity.h
@@ -1,8 +1,12 @@
-// WitherSkullEntity.h
+// WitherSkullEntity.h
// Declares the cWitherSkullEntity class representing the entity used by both blue and black wither skulls
+
+
+
+
#pragma once
#include "ProjectileEntity.h"
@@ -30,6 +34,10 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
- virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
+ virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
} ; // tolua_export
+
+
+
+