public void loadRegionDirectory(String dir) throws Exception{
		ArrayList<Chunk> chunkslist = new ArrayList<Chunk>();
		String[] files = (new File(dir)).list(new FilenameFilter(){
			@Override
			public boolean accept(File file, String filename) {
				return filename.toLowerCase().endsWith(".mca");
			}
		});
		System.out.printf("Loading %d region files\n", files.length);
		for (int i = 0; i < files.length; i++){
			System.out.printf("Loading %s\n", files[i]);
			Region region = new Region();
			region.readRegionFile(dir.concat(files[i]));
			for(int x = 0; x < 32; x++){
				for (int z = 0; z < 32; z++){
					if(region.chunk[x][z] != null){
						chunkslist.add(region.chunk[x][z]);
					}
				}
			}
		}
		System.out.println("Done loading regions, setting up chunks...");
		int maxx = Integer.MIN_VALUE, maxz = Integer.MIN_VALUE;
		for (Chunk chunk : chunkslist){
			offsetX = Math.min(offsetX, chunk.posX);
			offsetZ = Math.min(offsetZ, chunk.posZ);
			maxx = Math.max(maxx, chunk.posX);
			maxz = Math.max(maxz, chunk.posZ);
		}
		chunks = new Chunk[maxx - offsetX + 1][maxz - offsetZ + 1];
		offsetX = -offsetX;
		offsetZ = -offsetZ;
		for (Chunk chunk : chunkslist){
			chunks[chunk.posX + offsetX][offsetZ + chunk.posZ] = chunk;
		}
		System.out.println("Done");
	}