summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-07-24 12:15:48 +0200
committerSTRWarrior <niels.breuker@hotmail.nl>2014-07-24 12:15:48 +0200
commit9678341a11caa08a40c3ddb562d893fc0cd2ba73 (patch)
tree67b8f7e7306a3bad0a0a6a53c2fc44d554f0f499 /src/World.cpp
parentMerge pull request #1237 from tonibm19/master (diff)
downloadcuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.tar
cuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.tar.gz
cuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.tar.bz2
cuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.tar.lz
cuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.tar.xz
cuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.tar.zst
cuberite-9678341a11caa08a40c3ddb562d893fc0cd2ba73.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 4ddd11f59..104805209 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2975,21 +2975,31 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eTyp
int cWorld::SpawnMobFinalize(cMonster * a_Monster)
{
+ // Invalid cMonster object. Bail out.
if (!a_Monster)
+ {
return -1;
+ }
+
+ // Give the mob full health.
a_Monster->SetHealth(a_Monster->GetMaxHealth());
+
+ // A plugin doesn't agree with the spawn. bail out.
if (cPluginManager::Get()->CallHookSpawningMonster(*this, *a_Monster))
{
delete a_Monster;
a_Monster = NULL;
return -1;
}
+
+ // Initialize the monster into the current world.
if (!a_Monster->Initialize(*this))
{
delete a_Monster;
a_Monster = NULL;
return -1;
}
+
BroadcastSpawnEntity(*a_Monster);
cPluginManager::Get()->CallHookSpawnedMonster(*this, *a_Monster);