public static Region findRegion(File saveFolder,int dimension,int chunk_x,int chunk_z) throws IOException {
  int rx, rz;
  rx=chunk_x >> 5;
  rz=chunk_z >> 5;
  File dir;
  if (dimension == 0)   dir=new File(saveFolder.getAbsolutePath(),"region");
 else   dir=new File(saveFolder.getAbsolutePath(),"DIM" + dimension + "/region");
  File file=new File(dir,"/r." + rx + "."+ rz+ ".mca");
  if (!file.exists())   file=new File(dir,"/r." + rx + "."+ rz+ ".mcr");
  return new Region(file);
}

public static Region findRegion ( File saveFolder , int dimension , int chunk_x , int chunk_z ) throws IOException { int rx , rz ; rx = chunk_x > > 5 ; rz = chunk_z > > 5 ; File dir ; if ( dimension == 0 ) dir = new File ( saveFolder . getAbsolutePath ( ) , "region" ) ; else dir = new File ( saveFolder . getAbsolutePath ( ) , "DIM" + dimension + "/region" ) ; File file = new File ( dir , "/r." + rx + "." + rz + ".mca" ) ; if ( ! file . exists ( ) ) file = new File ( dir , "/r." + rx + "." + rz + ".mcr" ) ; return new Region ( file ) ; }
find a region file containing the chunk with given coordinates .
