summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-03-12 18:12:13 +0100
committerTycho <work.tycho+git@gmail.com>2014-03-12 18:12:13 +0100
commitd904e89712ee87b4b2bb73c6568f230fff15933a (patch)
tree50b4530dde0a80d1271c3bc1dab770f1f69fc7cd /src/Entities
parentAdded macros support to tools (diff)
parentFixed printf format compatabilty (diff)
downloadcuberite-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.cpp2
-rw-r--r--src/Entities/Entity.h4
-rw-r--r--src/Entities/Player.cpp1
-rw-r--r--src/Entities/ProjectileEntity.cpp26
-rw-r--r--src/Entities/ProjectileEntity.h1
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