if (isHalted(storedData, housing))
return storedData;
int[] areaAr = genome.getTerritory();
Vect area = new Vect(areaAr[0] * 2, areaAr[1] * 2, areaAr[2] * 2);
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
// Radioactivity hurts players and mobs
Vect min = new Vect(housing.getXCoord() + offset.x, housing.getYCoord() + offset.y, housing.getZCoord() + offset.z);
Vect max = new Vect(housing.getXCoord() + offset.x + area.x, housing.getYCoord() + offset.y + area.y, housing.getZCoord() + offset.z + area.z);
AxisAlignedBB hurtBox = AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
@SuppressWarnings("rawtypes")
List list = housing.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);
for (Object obj : list) {
EntityLivingBase entity = (EntityLivingBase) obj;
int damage = 8;
// Players are not attacked if they wear a full set of apiarist's
// armor.
if (entity instanceof EntityPlayer) {
int count = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
// Full set, no damage/effect
if (count > 3)
continue;
else if (count > 2)
damage = 1;
else if (count > 1)
damage = 2;
else if (count > 0)
damage = 3;
}
entity.attackEntityFrom(damageSourceBeeRadioactive, damage);
}
Random rand = housing.getWorld().rand;
// Radioactivity destroys environment
for (int i = 0; i < 20; i++) {
Vect randomPos = new Vect(rand.nextInt(area.x), rand.nextInt(area.y), rand.nextInt(area.z));
Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
posBlock = posBlock.add(offset);
if(posBlock.y <= 1 || posBlock.y >= housing.getWorld().getActualHeight())
continue;
// Don't destroy ourself and blocks below us.