Program: 1123
Project: 1123
Buggy source:
@Override public void generateChunk(Chunk c){
  double[][][] densityMap=new double[Chunk.SIZE_X + 1][Chunk.SIZE_Y + 1][Chunk.SIZE_Z + 1];
  for (int x=0; x <= Chunk.SIZE_X; x+=SAMPLE_RATE_3D_HOR) {
    for (int z=0; z <= Chunk.SIZE_Z; z+=SAMPLE_RATE_3D_HOR) {
      for (int y=0; y <= Chunk.SIZE_Y; y+=SAMPLE_RATE_3D_VERT) {
        densityMap[x][y][z]=calcDensity(c.getBlockWorldPosX(x),y,c.getBlockWorldPosZ(z));
      }
    }
  }
  triLerpDensityMap(densityMap);
  for (int x=0; x < Chunk.SIZE_X; x++) {
    for (int z=0; z < Chunk.SIZE_Z; z++) {
      WorldBiomeProvider.Biome type=biomeProvider.getBiomeAt(c.getBlockWorldPosX(x),c.getBlockWorldPosZ(z));
      int firstBlockHeight=-1;
      for (int y=Chunk.SIZE_Y; y >= 0; y--) {
        if (y == 0) {
          c.setBlock(x,y,z,mantle);
          break;
        }
        if (y <= 32 && y > 0) {
          c.setBlock(x,y,z,water);
          c.setLiquid(x,y,z,new LiquidData(LiquidType.WATER,Chunk.MAX_LIQUID_DEPTH));
          if (y == 32) {
            if (type == WorldBiomeProvider.Biome.SNOW)             c.setBlock(x,y,z,ice);
          }
        }
        double dens=densityMap[x][y][z];
        if ((dens >= 0 && dens < 32)) {
          if (firstBlockHeight == -1)           firstBlockHeight=y;
          if (calcCaveDensity(c.getBlockWorldPosX(x),y,c.getBlockWorldPosZ(z)) > -0.7)           GenerateOuterLayer(x,y,z,firstBlockHeight,c,type);
 else           c.setBlock(x,y,z,air);
          continue;
        }
 else         if (dens >= 32) {
          if (firstBlockHeight == -1)           firstBlockHeight=y;
          if (calcCaveDensity(c.getBlockWorldPosX(x),y,c.getBlockWorldPosZ(z)) > -0.6)           GenerateInnerLayer(x,y,z,c,type);
 else           c.setBlock(x,y,z,air);
          continue;
        }
        firstBlockHeight=-1;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void generateChunk(Chunk c){
  double[][][] densityMap=new double[Chunk.SIZE_X + 1][Chunk.SIZE_Y + 1][Chunk.SIZE_Z + 1];
  for (int x=0; x <= Chunk.SIZE_X; x+=SAMPLE_RATE_3D_HOR) {
    for (int z=0; z <= Chunk.SIZE_Z; z+=SAMPLE_RATE_3D_HOR) {
      for (int y=0; y <= Chunk.SIZE_Y; y+=SAMPLE_RATE_3D_VERT) {
        densityMap[x][y][z]=calcDensity(c.getBlockWorldPosX(x),y,c.getBlockWorldPosZ(z));
      }
    }
  }
  triLerpDensityMap(densityMap);
  for (int x=0; x < Chunk.SIZE_X; x++) {
    for (int z=0; z < Chunk.SIZE_Z; z++) {
      WorldBiomeProvider.Biome type=biomeProvider.getBiomeAt(c.getBlockWorldPosX(x),c.getBlockWorldPosZ(z));
      int firstBlockHeight=-1;
      for (int y=Chunk.SIZE_Y - 1; y >= 0; y--) {
        if (y == 0) {
          c.setBlock(x,y,z,mantle);
          break;
        }
        if (y <= 32 && y > 0) {
          c.setBlock(x,y,z,water);
          c.setLiquid(x,y,z,new LiquidData(LiquidType.WATER,Chunk.MAX_LIQUID_DEPTH));
          if (y == 32) {
            if (type == WorldBiomeProvider.Biome.SNOW)             c.setBlock(x,y,z,ice);
          }
        }
        double dens=densityMap[x][y][z];
        if ((dens >= 0 && dens < 32)) {
          if (firstBlockHeight == -1)           firstBlockHeight=y;
          if (calcCaveDensity(c.getBlockWorldPosX(x),y,c.getBlockWorldPosZ(z)) > -0.7)           GenerateOuterLayer(x,y,z,firstBlockHeight,c,type);
 else           c.setBlock(x,y,z,air);
          continue;
        }
 else         if (dens >= 32) {
          if (firstBlockHeight == -1)           firstBlockHeight=y;
          if (calcCaveDensity(c.getBlockWorldPosX(x),y,c.getBlockWorldPosZ(z)) > -0.6)           GenerateInnerLayer(x,y,z,c,type);
 else           c.setBlock(x,y,z,air);
          continue;
        }
        firstBlockHeight=-1;
      }
    }
  }
}