for (var i = 0; spawnedEntities != undefined && i < spawnedEntities.length; i++) 
{var ent = spawnedEntities[i]; var epos = ent.getPosition(); var pos = player.getPosition();
for (ii = 0; entities [ii] != undefined && entities [ii] [0] != ent.entityID; ii++) {}
var dist = Math.sqrt(Math.pow(epos.x-pos.x,2)+Math.pow(epos.y-pos.y,2)+Math.pow(epos.z-pos.z,2));
if (!ent.isAlive()) {if (spawned == 2 && Math.floor(dist) < 4)
{effect.setOverlay("light.png"); blind = 60;} if (sk[i] < 10) {var drops = ent.getEntitiesWithinRange(1);
for (var j = 0; j < drops.length; j++) {if (drops[j].getClassType() == "Item") {drops[j].setDead();}} sk[i]++;}
else {
if (entities [ii] != undefined) {
drop(ent); function drop() {};
ent.spawnExplosionParticle(); ent.setDead(); sk.splice(i, 1);
entities [ii] = [0, 0, 0];}
}}   

if (spawned == 1 && Math.floor(dist) < 5)
{explode ++; if (explode > 35) {effect.explode(ent, epos.x, epos.y, epos.z, 6, true); ent.setDead();}
if (explode > 5) {ent.setTexture("mob/intense_creeper.png");}}
if (spawned == 1 && Math.floor(dist) >= 5) {var explode = 0; ent.setTexture("mob/red_creeper.png");}

if (spawned == 3 && dist < 2.5) {explode ++; if (explode > 20 && Math.random()*15 > 14) 
{player.heal(-ent.getAttackStrength()); sound.playSoundUI("sound.reaper_attack");}
if (explode > 3) {ent.setTexture("mob/intense_reaper.png");}}
if (spawned == 3 && dist >= 2.5) {var explode = 0; ent.setTexture("mob/reaper.png");}
everyTick();

if (entities [ii] == undefined) {
for (ii = 0; entities [ii] != undefined && entities [ii] [0] != 0; ii++) {}
entities [ii] = []; entities [ii] [0] = ent.entityID; 
entities [ii] [1] = 1; entities [ii] [2] = ent.health;}

if (entities [ii] != undefined && entities [ii] [2] != ent.health && dist < 10) 
{entities [ii] [2] = ent.health;}

if (entities [ii] != undefined && entities [ii] [1] == 1) {
entities [ii] [1] = 0;
function drop()
{if (spawned == 1) {effect.explode(ent, epos.x, epos.y, epos.z, 4, true);}
var rand = Math.floor(Math.random() * random_max);
if (rand > random_1 && rand < random_2) 
{ent.dropItem(Item(itemID_1,itemMin_1 + Math.random() * (itemMax_1 - itemMin_1), itemDmg_1));}
if (rand > random_3 && rand < random_4) 
{ent.dropItem(Item(itemID_2,itemMin_2 + Math.random() * (itemMax_2 - itemMin_2), itemDmg_2));}
if (rand > random_5 && rand < random_6) 
{ent.dropItem(Item(itemID_3,itemMin_3 + Math.random() * (itemMax_3 - itemMin_3), itemDmg_3));}
if (rand > random_7 && rand < random_8) 
{ent.dropItem(Item(itemID_4,itemMin_4 + Math.random() * (itemMax_4 - itemMin_4), itemDmg_4));}
if (rand > random_9 && rand < random_10) 
{ent.dropItem(Item(itemID_5,itemMin_5 + Math.random() * (itemMax_5 - itemMin_5), itemDmg_5));}}}}