// Ice Mob

try
{
	for (var i = 0; i < spawnedEntities.length; i++) 
	{
		var ent = spawnedEntities[i];
				ent.setAttackStrength(4);
		if(ent.isAlive()) 
		{
			//OPTIONAL:
			ent.texture = "/ice/" + ent.getClassType() + ".png"
			//ENDOPTIONAL
			var target = ent.getEntitiesWithinRange(2);
			for(var j = 0; j < target.length; j++) 
			{
				var entj = target[j];
				if (entj.getClassType() == "Player") 
				{
									player.setStunned(10)
									effect.setOverlay("ice.png");
				}   
			}
			Epos = ent.getPosition();
			for(var k = 0; k < 10; k++)
			{
				effect.spawnParticle("reddust", Epos.x + Math.random() - 0.5, Epos.y + Math.random(), Epos.z + Math.random() - 0.5, -1, 1, 1);
			}
		}
	}

	if(player.getStunned() == 0 || player.getHealth() == 0)
	{
		if(effect.getOverlay() == "ice.png")
		{
			effect.clearOverlay();
		}
	}
} catch(e) {}
