diff options
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 1 | ||||
-rw-r--r-- | src/Entities/ThrownEnderPearlEntity.cpp | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index b6204387b..4d61a5744 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -494,6 +494,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) case mtSpider: case mtCaveSpider: case mtSilverfish: + case mtEndermite: { MagicalCriticalHit = true; a_TDI.FinalDamage += 2.5f * BaneOfArthropodsLevel; 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; }); } |