@Override
public void onUpdate() {
super.onUpdate();
if(ticksExisted % 5 == 0) {
List<EntitySlime> slimes = supertile.getWorld().getEntitiesWithinAABB(EntitySlime.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(EntitySlime slime : slimes) {
if(slime.getEntityData().getBoolean(TAG_WORLD_SPAWNED) && !slime.isDead) {
int size = slime.getSlimeSize();
int mul = (int) Math.pow(2, size);
int mana = 1200 * mul;
if(!slime.world.isRemote) {
slime.setDead();
slime.playSound(size > 1 ? SoundEvents.ENTITY_SLIME_SQUISH : SoundEvents.ENTITY_SMALL_SLIME_SQUISH, 1, 0.02F);
this.mana = Math.min(getMaxMana(), this.mana + mana);
sync();
}
for (int j = 0; j < mul * 8; ++j) {
float f = slime.world.rand.nextFloat() * (float)Math.PI * 2.0F;
float f1 = slime.world.rand.nextFloat() * 0.5F + 0.5F;
float f2 = MathHelper.sin(f) * size * 0.5F * f1;
float f3 = MathHelper.cos(f) * size * 0.5F * f1;
float f4 = slime.world.rand.nextFloat() * size * 0.5F * f1;
slime.world.spawnParticle(EnumParticleTypes.SLIME, slime.posX + f2, slime.getEntityBoundingBox().minY + f4, slime.posZ + f3, 0.0D, 0.0D, 0.0D);
}
break;
}
}
}
}