public static void chunkTaskSync(RegionWrapper region,final RunnableVal<int[]> task){
  final int p1x=region.minX;
  final int p1z=region.minZ;
  final int p2x=region.maxX;
  final int p2z=region.maxZ;
  final int bcx=p1x >> 4;
  final int bcz=p1z >> 4;
  final int tcx=p2x >> 4;
  final int tcz=p2z >> 4;
  task.value=new int[7];
  for (int x=bcx; x <= tcx; x++) {
    for (int z=bcz; z <= tcz; z++) {
      task.value[0]=x;
      task.value[1]=z;
      task.value[2]=task.value[0] << 4;
      task.value[3]=task.value[1] << 4;
      task.value[4]=task.value[2] + 15;
      task.value[5]=task.value[3] + 15;
      task.value[6]=0;
      if (task.value[0] == bcx) {
        task.value[2]=p1x;
        task.value[6]=1;
      }
      if (task.value[0] == tcx) {
        task.value[4]=p2x;
        task.value[6]=1;
      }
      if (task.value[1] == bcz) {
        task.value[3]=p1z;
        task.value[6]=1;
      }
      if (task.value[1] == tcz) {
        task.value[5]=p2z;
        task.value[6]=1;
      }
      task.run();
    }
  }
}

public static void chunkTaskSync ( RegionWrapper region , final RunnableVal < int [ ] > task ) { final int p1x = region . minX ; final int p1z = region . minZ ; final int p2x = region . maxX ; final int p2z = region . maxZ ; final int bcx = p1x > > 4 ; final int bcz = p1z > > 4 ; final int tcx = p2x > > 4 ; final int tcz = p2z > > 4 ; task . value = new int [ 7 ] ; for ( int x = bcx ; x <= tcx ; x ++ ) { for ( int z = bcz ; z <= tcz ; z ++ ) { task . value [ 0 ] = x ; task . value [ 1 ] = z ; task . value [ 2 ] = task . value [ 0 ] << 4 ; task . value [ 3 ] = task . value [ 1 ] << 4 ; task . value [ 4 ] = task . value [ 2 ] + 15 ; task . value [ 5 ] = task . value [ 3 ] + 15 ; task . value [ 6 ] = 0 ; if ( task . value [ 0 ] == bcx ) { task . value [ 2 ] = p1x ; task . value [ 6 ] = 1 ; } if ( task . value [ 0 ] == tcx ) { task . value [ 4 ] = p2x ; task . value [ 6 ] = 1 ; } if ( task . value [ 1 ] == bcz ) { task . value [ 3 ] = p1z ; task . value [ 6 ] = 1 ; } if ( task . value [ 1 ] == tcz ) { task . value [ 5 ] = p2z ; task . value [ 6 ] = 1 ; } task . run ( ) ; } } }
the int [ ] will be in the form : [ chunkx , chunkz , pos1x , pos1z , pos2x , pos2z , isedge ] and will represent the bottom and top parts of the chunk
