Program: 34718
Project: 34718
Buggy source:
@Override public void update(){
  super.update();
  if (++timer > 125 - getDifficulty() * 10) {
    timer=-10;
    for (    EntityPlayer player : dragon.attacks.getViablePlayers()) {
      EntityEnderman enderman=DragonUtil.getClosestEntity(player,dragon.worldObj.getEntitiesWithinAABB(EntityEnderman.class,player.boundingBox.expand(18D,8D,18D)));
      if (enderman == null) {
        int px=0, py=0, pz=0;
        for (int attempt=0; attempt < 40; attempt++) {
          float rad=rand.nextFloat() * (float)Math.PI * 2F;
          double len=10D + rand.nextDouble() * 8D;
          px=(int)Math.round(player.posX + MathHelper.sin(rad) * len);
          py=(int)Math.round(player.posY - (rand.nextDouble() - 0.5D) * 6D);
          pz=(int)Math.round(player.posZ + MathHelper.cos(rad) * len);
          if (dragon.worldObj.isAirBlock(px,py,pz))           break;
        }
        for (int a=0, xx, yy, zz; a < 2 + rand.nextInt(3) + (getDifficulty() >> 1); a++) {
          for (int attempt=0; attempt < 6; attempt++) {
            if (dragon.worldObj.isAirBlock(xx=px + rand.nextInt(3) - 1,yy=py + rand.nextInt(3) - 1,zz=pz + rand.nextInt(3) - 1))             break;
          }
          spawnBatAt(px,py,pz,player);
        }
      }
 else {
        for (int a=0; a < 2 + rand.nextInt(3) + (getDifficulty() >> 1); a++) {
          spawnBatAt(enderman.posX + rand.nextDouble() - 0.5D,enderman.posY + rand.nextDouble() * enderman.height,enderman.posZ + rand.nextDouble() - 0.5D,player);
        }
        enderman.setDead();
        PacketPipeline.sendToAllAround(enderman,64D,new C20Effect(FXType.Basic.ENDERMAN_BLOODLUST_TRANSFORMATION,enderman));
      }
    }
    if (++counter > 3 + (getDifficulty() >> 1) + rand.nextInt(3))     ended=true;
  }
}

Fixed version (ground truth):
@Override public void update(){
  super.update();
  if (++timer > 125 - getDifficulty() * 10) {
    timer=-10;
    for (    EntityPlayer player : dragon.attacks.getViablePlayers()) {
      EntityEnderman enderman=DragonUtil.getClosestEntity(player,(List<EntityEnderman>)dragon.worldObj.getEntitiesWithinAABB(EntityEnderman.class,player.boundingBox.expand(18D,8D,18D)));
      if (enderman == null) {
        int px=0, py=0, pz=0;
        for (int attempt=0; attempt < 40; attempt++) {
          float rad=rand.nextFloat() * (float)Math.PI * 2F;
          double len=10D + rand.nextDouble() * 8D;
          px=(int)Math.round(player.posX + MathHelper.sin(rad) * len);
          py=(int)Math.round(player.posY - (rand.nextDouble() - 0.5D) * 6D);
          pz=(int)Math.round(player.posZ + MathHelper.cos(rad) * len);
          if (dragon.worldObj.isAirBlock(px,py,pz))           break;
        }
        for (int a=0, xx, yy, zz; a < 2 + rand.nextInt(3) + (getDifficulty() >> 1); a++) {
          for (int attempt=0; attempt < 6; attempt++) {
            if (dragon.worldObj.isAirBlock(xx=px + rand.nextInt(3) - 1,yy=py + rand.nextInt(3) - 1,zz=pz + rand.nextInt(3) - 1))             break;
          }
          spawnBatAt(px,py,pz,player);
        }
      }
 else {
        for (int a=0; a < 2 + rand.nextInt(3) + (getDifficulty() >> 1); a++) {
          spawnBatAt(enderman.posX + rand.nextDouble() - 0.5D,enderman.posY + rand.nextDouble() * enderman.height,enderman.posZ + rand.nextDouble() - 0.5D,player);
        }
        enderman.setDead();
        PacketPipeline.sendToAllAround(enderman,64D,new C20Effect(FXType.Basic.ENDERMAN_BLOODLUST_TRANSFORMATION,enderman));
      }
    }
    if (++counter > 3 + (getDifficulty() >> 1) + rand.nextInt(3))     ended=true;
  }
}