@SuppressWarnings("unchecked")
  private void potion() {
    List<EntityLivingBase> ents =
        worldObj.getEntitiesWithinAABB(
            EntityLivingBase.class,
            AxisAlignedBB.getBoundingBox(
                xCoord + 1.0,
                yCoord + 1.0,
                zCoord + 1.0,
                xCoord + xLength - 1,
                yCoord + 3.0,
                zCoord + zLength - 1));
    if (ents != null && ents.size() > 0) {
      Potion potion = null;
      // Try and find a potion, 15 times max
      for (int i = 0; i < 15; i++) {
        potion = Potion.potionTypes[worldObj.rand.nextInt(Potion.potionTypes.length)];
        if (potion != null) break;
      }

      if (potion == null) return;

      EntityLivingBase ent = ents.get(worldObj.rand.nextInt(ents.size()));
      ent.addPotionEffect(
          new PotionEffect(potion.id, MathHelper.randomIntInRange(3, 10), 1, false));
    }
  }
 private void spawnLightning() {
   int ran = MathHelper.randomIntInRange(1, 5);
   for (int i = 0; i < ran; i++) {
     worldObj.addWeatherEffect(
         new EntityLightningBolt(
             worldObj,
             xCoord + 2 + MathHelper.randomDoubleInRange(0, xLength - 3),
             yCoord + 1.0,
             zCoord + 2 + MathHelper.randomDoubleInRange(0, zLength - 3)));
   }
 }
 @Override
 public void updateEntity() {
   super.updateEntity();
   if (isMaster) {
     count++;
     if (count >= delay) {
       act();
       // Reset
       count = 0;
       delay = MathHelper.randomIntInRange(ACTIONDELAY_MIN, ACTIONDELAY_MAX);
     }
   }
 }