public static int[][] scanChunk(World world,int offsetX,int offsetZ,int radius,int blocksPerPixel){
  blocksPerPixel=Math.max(blocksPerPixel,1);
  int[][] ret=new int[(radius * 2) / blocksPerPixel][(radius * 2) / blocksPerPixel];
  Chunk chunk=world.getChunkFromBlockCoords(offsetX,offsetZ);
  IChunkProvider provider=world.getChunkProvider();
  if (oreList.isEmpty()) {
    String[] strings=OreDictionary.getOreNames();
    for (    String str : strings) {
      if (str.contains("ore"))       oreList.add(OreDictionary.getOreID(str));
    }
  }
  for (int z=-radius; z < radius; z+=blocksPerPixel) {
    for (int x=-radius; x < radius; x+=blocksPerPixel) {
      int oreCount=0, otherCount=0;
      for (int y=world.getHeight(); y > 0; y--) {
        for (int deltaY=0; deltaY < blocksPerPixel; deltaY++) {
          for (int deltaZ=0; deltaZ < blocksPerPixel; deltaZ++) {
            if (world.isAirBlock(x + offsetX,y,z + offsetZ))             continue;
            boolean exists=false;
            out:             for (            int i : oreList) {
              ArrayList<ItemStack> itemlist=OreDictionary.getOres(i);
              for (              ItemStack item : itemlist) {
                if (item.getItem() == Item.getItemFromBlock(world.getBlock(x + offsetX,y,z + offsetZ))) {
                  exists=true;
                  break out;
                }
              }
            }
            if (exists)             oreCount++;
 else             otherCount++;
          }
        }
      }
      oreCount/=Math.pow(blocksPerPixel,2);
      otherCount/=Math.pow(blocksPerPixel,2);
      if (Thread.interrupted())       return null;
      ret[(x + radius) / blocksPerPixel][(z + radius) / blocksPerPixel]=(int)((oreCount / (float)Math.max(otherCount,1)) * 0xFFFF);
    }
  }
  return ret;
}

public static int [ ] [ ] scanChunk ( World world , int offsetX , int offsetZ , int radius , int blocksPerPixel ) { blocksPerPixel = Math . max ( blocksPerPixel , 1 ) ; int [ ] [ ] ret = new int [ ( radius * 2 ) / blocksPerPixel ] [ ( radius * 2 ) / blocksPerPixel ] ; Chunk chunk = world . getChunkFromBlockCoords ( offsetX , offsetZ ) ; IChunkProvider provider = world . getChunkProvider ( ) ; if ( oreList . isEmpty ( ) ) { String [ ] strings = OreDictionary . getOreNames ( ) ; for ( String str : strings ) { if ( str . contains ( "ore" ) ) oreList . add ( OreDictionary . getOreID ( str ) ) ; } } for ( int z = - radius ; z < radius ; z += blocksPerPixel ) { for ( int x = - radius ; x < radius ; x += blocksPerPixel ) { int oreCount = 0 , otherCount = 0 ; for ( int y = world . getHeight ( ) ; y > 0 ; y -- ) { for ( int deltaY = 0 ; deltaY < blocksPerPixel ; deltaY ++ ) { for ( int deltaZ = 0 ; deltaZ < blocksPerPixel ; deltaZ ++ ) { if ( world . isAirBlock ( x + offsetX , y , z + offsetZ ) ) continue ; boolean exists = false ; out : for ( int i : oreList ) { ArrayList < ItemStack > itemlist = OreDictionary . getOres ( i ) ; for ( ItemStack item : itemlist ) { if ( item . getItem ( ) == Item . getItemFromBlock ( world . getBlock ( x + offsetX , y , z + offsetZ ) ) ) { exists = true ; break out ; } } } if ( exists ) oreCount ++ ; else otherCount ++ ; } } } oreCount /= Math . pow ( blocksPerPixel , 2 ) ; otherCount /= Math . pow ( blocksPerPixel , 2 ) ; if ( Thread . interrupted ( ) ) return null ; ret [ ( x + radius ) / blocksPerPixel ] [ ( z + radius ) / blocksPerPixel ] = ( int ) ( ( oreCount / ( float ) Math . max ( otherCount , 1 ) ) * 0xFFFF ) ; } } return ret ; }
note : array returned will be [ radius / blocksperpixel ] [ radius / blocksperpixel ]
