summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-03-12 17:59:10 +0100
committerTycho <work.tycho+git@gmail.com>2014-03-12 17:59:10 +0100
commit3caa4a38b9a60afdda0e76cfb267c49ffac1063c (patch)
tree89bd29d89d6892a94137ebf4829dfe6a4ae3c450 /src/Entities
parentFixed comments an assert (diff)
parentFixed missing comment terminator. (diff)
downloadcuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.tar
cuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.tar.gz
cuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.tar.bz2
cuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.tar.lz
cuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.tar.xz
cuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.tar.zst
cuberite-3caa4a38b9a60afdda0e76cfb267c49ffac1063c.zip
Diffstat (limited to 'src/Entities')
-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