summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorDebucquoy Anthony tonitch <debucquoy.anthony@gmail.com>2023-09-26 23:54:37 +0200
committerGitHub <noreply@github.com>2023-09-26 23:54:37 +0200
commit7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97 (patch)
tree62ce535a26ad0637564de14ad7b75429537162a7 /src/Entities
parentUpdate Core (diff)
downloadcuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.gz
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.bz2
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.lz
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.xz
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.zst
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.cpp1
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp16
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;
});
}