diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-03-12 18:12:13 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-03-12 18:12:13 +0100 |
commit | d904e89712ee87b4b2bb73c6568f230fff15933a (patch) | |
tree | 50b4530dde0a80d1271c3bc1dab770f1f69fc7cd /src/Entities | |
parent | Added macros support to tools (diff) | |
parent | Fixed printf format compatabilty (diff) | |
download | cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.tar cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.tar.gz cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.tar.bz2 cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.tar.lz cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.tar.xz cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.tar.zst cuberite-d904e89712ee87b4b2bb73c6568f230fff15933a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Entity.h | 4 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 1 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 26 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.h | 1 |
5 files changed, 28 insertions, 6 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 96e8c15a5..0750ae05e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -4,7 +4,7 @@ #include "../World.h" #include "../Server.h" #include "../Root.h" -#include "../Matrix4f.h" +#include "../Matrix4.h" #include "../ClientHandle.h" #include "../Chunk.h" #include "../Simulator/FluidSimulator.h" diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index b3b1cef83..a73565de7 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -2,9 +2,7 @@ #pragma once #include "../Item.h" -#include "../Vector3d.h" -#include "../Vector3f.h" -#include "../Vector3i.h" +#include "../Vector3.h" diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index ccdd151f3..440d30595 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -14,6 +14,7 @@ #include "../OSSupport/Timer.h" #include "../Chunk.h" #include "../Items/ItemHandler.h" +#include "../Vector3.h" #include "inifile/iniFile.h" #include "json/json.h" diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 12d2025ec..f4ab825f2 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -663,8 +663,6 @@ cThrownSnowballEntity::cThrownSnowballEntity(cEntity * a_Creator, double a_X, do void cThrownSnowballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) { - // TODO: Apply damage to certain mobs (blaze etc.) and anger all mobs - Destroy(); } @@ -672,6 +670,30 @@ void cThrownSnowballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFac +void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) +{ + int TotalDamage = 0; + if (a_EntityHit.IsMob()) + { + cMonster::eType MobType = ((cMonster &) a_EntityHit).GetMobType(); + if (MobType == cMonster::mtBlaze) + { + TotalDamage = 3; + } + else if (MobType == cMonster::mtEnderDragon) + { + TotalDamage = 1; + } + } + a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1); + + Destroy(true); +} + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cBottleOEnchantingEntity : diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index fac592d16..efb7ae783 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -259,6 +259,7 @@ 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; // tolua_begin |