summaryrefslogtreecommitdiffstats
path: root/src/Entities/ThrownEnderPearlEntity.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
committerAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
commitcb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch)
treef647b20e1823f1846af88e832cf82a4a02e96e69 /src/Entities/ThrownEnderPearlEntity.cpp
parentImprove clang-format config file, remove automatically enforced code style from contrib guide. (diff)
downloadcuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip
Diffstat (limited to 'src/Entities/ThrownEnderPearlEntity.cpp')
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index 6fc21e179..8b41a7e92 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -10,7 +10,7 @@
-cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
+cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed) :
Super(pkEnderPearl, a_Creator, a_Pos, a_Speed, 0.25f, 0.25f)
{
}
@@ -60,23 +60,25 @@ void cThrownEnderPearlEntity::TeleportCreator(Vector3d a_HitPos)
- GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, [=](cPlayer & a_Entity)
- {
-
- auto & Random = GetRandomProvider();
-
- // 5% chance to spawn an endermite
- if (Random.RandBool(0.05))
+ GetWorld()->FindAndDoWithPlayer(
+ m_CreatorData.m_Name,
+ [=](cPlayer & a_Entity)
{
- Vector3d PlayerPosition = a_Entity.GetPosition();
- m_World->SpawnMob(PlayerPosition.x, PlayerPosition.y, PlayerPosition.z, mtEndermite);
- }
+ auto & Random = GetRandomProvider();
+
+ // 5% chance to spawn an endermite
+ if (Random.RandBool(0.05))
+ {
+ Vector3d PlayerPosition = a_Entity.GetPosition();
+ m_World->SpawnMob(PlayerPosition.x, PlayerPosition.y, PlayerPosition.z, mtEndermite);
+ }
- // Teleport the creator here, make them take 5 damage:
- a_Entity.TeleportToCoords(a_HitPos.x, a_HitPos.y + 0.2, a_HitPos.z);
- a_Entity.TakeDamage(dtEnderPearl, this, 5, 0);
+ // Teleport the creator here, make them take 5 damage:
+ a_Entity.TeleportToCoords(a_HitPos.x, a_HitPos.y + 0.2, a_HitPos.z);
+ a_Entity.TakeDamage(dtEnderPearl, this, 5, 0);
- return false;
- });
+ return false;
+ }
+ );
}