summaryrefslogtreecommitdiffstats
path: root/src/Entities/ThrownEnderPearlEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/ThrownEnderPearlEntity.cpp')
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index 6fe4ce5be..6fc21e179 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -1,6 +1,8 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+#include "FastRandom.h"
+#include "Mobs/MonsterTypes.h"
#include "ThrownEnderPearlEntity.h"
#include "Player.h"
@@ -56,11 +58,25 @@ void cThrownEnderPearlEntity::TeleportCreator(Vector3d a_HitPos)
return;
}
+
+
GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, [=](cPlayer & a_Entity)
{
+
+ 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);
+
return false;
});
}