summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Creeper.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-05 23:59:22 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-05 23:59:22 +0200
commit460d6bd0cbb799a6e68f1bc264f55c3d89eb8206 (patch)
tree5d5d769e0e624f20c40c90cfb32045e01ec4e3e4 /src/Mobs/Creeper.cpp
parentCrash and compile fix (diff)
downloadcuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.tar
cuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.tar.gz
cuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.tar.bz2
cuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.tar.lz
cuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.tar.xz
cuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.tar.zst
cuberite-460d6bd0cbb799a6e68f1bc264f55c3d89eb8206.zip
Diffstat (limited to 'src/Mobs/Creeper.cpp')
-rw-r--r--src/Mobs/Creeper.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index a7b97f604..b9041bd5a 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -67,9 +67,27 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
}
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
- if ((a_Killer != NULL) && (a_Killer->IsProjectile()))
+ if ((a_Killer != NULL) && a_Killer->IsProjectile() && (((cProjectileEntity *)a_Killer)->GetCreatorUniqueID() >= 0))
{
- if (((cMonster *)((cProjectileEntity *)a_Killer)->GetCreator())->GetMobType() == mtSkeleton)
+ class cProjectileCreatorCallback : public cEntityCallback
+ {
+ public:
+ cProjectileCreatorCallback(void)
+ {
+ }
+
+ virtual bool Item(cEntity * a_Entity) override
+ {
+ if (a_Entity->IsMob() && ((cMonster *)a_Entity)->GetMobType() == mtSkeleton)
+ {
+ return true;
+ }
+ return false;
+ }
+ };
+
+ cProjectileCreatorCallback PCC;
+ if (GetWorld()->DoWithEntityByID(((cProjectileEntity *)a_Killer)->GetCreatorUniqueID(), PCC))
{
// 12 music discs. TickRand starts from 0 to 11. Disk IDs start at 2256, so add that. There.
AddRandomDropItem(a_Drops, 1, 1, (short)m_World->GetTickRandomNumber(11) + 2256);