summaryrefslogtreecommitdiffstats
path: root/src/Entities/ThrownEggEntity.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2015-11-02 20:04:56 +0100
committerAlexander Harkness <bearbin@gmail.com>2015-11-05 17:42:42 +0100
commit1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5 (patch)
tree37ffa2e51a376451d3235f5e3c87a53e1b9cc36c /src/Entities/ThrownEggEntity.cpp
parentMerge pull request #2587 from cuberite/bountysource-not-gratipay (diff)
downloadcuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.tar
cuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.tar.gz
cuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.tar.bz2
cuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.tar.lz
cuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.tar.xz
cuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.tar.zst
cuberite-1d4c6d3fbef0e39d7bad9e2352be642c92bc2ff5.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/ThrownEggEntity.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Entities/ThrownEggEntity.cpp b/src/Entities/ThrownEggEntity.cpp
index 91bca1da7..d302151d8 100644
--- a/src/Entities/ThrownEggEntity.cpp
+++ b/src/Entities/ThrownEggEntity.cpp
@@ -21,7 +21,7 @@ cThrownEggEntity::cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y,
void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
TrySpawnChicken(a_HitPos);
-
+
m_DestroyTimer = 2;
}
@@ -32,11 +32,18 @@ void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_H
void cThrownEggEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
int TotalDamage = 0;
- // TODO: If entity is Ender Crystal, destroy it
-
+ // If entity is an Ender Dragon or Ender Crystal, it is damaged.
+ if (
+ (a_EntityHit.IsMob() && (static_cast<cMonster &>(a_EntityHit).GetMobType() == mtEnderDragon)) ||
+ a_EntityHit.IsEnderCrystal()
+ )
+ {
+ TotalDamage = 1;
+ }
+
TrySpawnChicken(a_HitPos);
a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
-
+
m_DestroyTimer = 5;
}
@@ -79,3 +86,7 @@ void cThrownEggEntity::TrySpawnChicken(const Vector3d & a_HitPos)
m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, mtChicken, false);
}
}
+
+
+
+