summaryrefslogtreecommitdiffstats
path: root/src/Entities/ThrownEnderPearlEntity.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-11 23:20:49 +0200
committerMattes D <github@xoft.cz>2017-09-11 23:20:49 +0200
commite225b7f8262df48ad4d7094bc295add3007b0649 (patch)
treea42e9afcc88cfe6e9d1258458e3ad42764083d0e /src/Entities/ThrownEnderPearlEntity.cpp
parentcBlockArea: change MakeIndex to return size_t (diff)
downloadcuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.gz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.bz2
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.lz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.xz
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.zst
cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.zip
Diffstat (limited to 'src/Entities/ThrownEnderPearlEntity.cpp')
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index 4dedffc5b..ca362d3bd 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -74,29 +74,12 @@ void cThrownEnderPearlEntity::TeleportCreator(Vector3d a_HitPos)
return;
}
- class cProjectileCreatorCallbackForPlayers : public cPlayerListCallback
- {
- public:
- cProjectileCreatorCallbackForPlayers(cEntity * a_Attacker, Vector3i a_CallbackHitPos) :
- m_Attacker(a_Attacker),
- m_HitPos(a_CallbackHitPos)
- {
- }
-
- virtual bool Item(cPlayer * a_Entity) override
+ GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, [=](cPlayer & a_Entity)
{
// Teleport the creator here, make them take 5 damage:
- a_Entity->TeleportToCoords(m_HitPos.x, m_HitPos.y + 0.2, m_HitPos.z);
- a_Entity->TakeDamage(dtEnderPearl, m_Attacker, 5, 0);
+ a_Entity.TeleportToCoords(a_HitPos.x, a_HitPos.y + 0.2, a_HitPos.z);
+ a_Entity.TakeDamage(dtEnderPearl, this, 5, 0);
return true;
}
-
- private:
-
- cEntity * m_Attacker;
- Vector3i m_HitPos;
- };
-
- cProjectileCreatorCallbackForPlayers PCCFP(this, a_HitPos);
- GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, PCCFP);
+ );
}