diff options
author | Mattes D <github@xoft.cz> | 2014-07-27 21:39:39 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-07-27 21:39:39 +0200 |
commit | 0814a977f8a99fb776a73b44bff14b2a6fb11059 (patch) | |
tree | edd7271430e1c0204808b3c12b7735959677b733 /src/Entities/Entity.cpp | |
parent | NetherClumpGenerator: Fixed generating stuff on halfslabs and fences (diff) | |
parent | Derp. (diff) | |
download | cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.tar cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.tar.gz cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.tar.bz2 cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.tar.lz cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.tar.xz cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.tar.zst cuberite-0814a977f8a99fb776a73b44bff14b2a6fb11059.zip |
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r-- | src/Entities/Entity.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index db0fd0fd6..6c3d7b40c 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -12,6 +12,7 @@ #include "../Bindings/PluginManager.h" #include "../Tracer.h" #include "Player.h" +#include "Items/ItemHandler.h" @@ -289,11 +290,6 @@ void cEntity::SetPitchFromSpeed(void) bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) { - if (cRoot::Get()->GetPluginManager()->CallHookTakeDamage(*this, a_TDI)) - { - return false; - } - if (m_Health <= 0) { // Can't take damage if already dead @@ -306,10 +302,17 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) return false; } + if (cRoot::Get()->GetPluginManager()->CallHookTakeDamage(*this, a_TDI)) + { + return false; + } + if ((a_TDI.Attacker != NULL) && (a_TDI.Attacker->IsPlayer())) { cPlayer * Player = (cPlayer *)a_TDI.Attacker; + Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this); + // IsOnGround() only is false if the player is moving downwards // TODO: Better damage increase, and check for enchantments (and use magic critical instead of plain) if (!Player->IsOnGround()) |