public static void saveChunk(String name, Chunk c) throws Exception{
		String chunkPath = path +"/"+ name +"/chunks/";
		if (!new FileHandle(chunkPath).exists())
			new FileHandle(chunkPath).mkdirs();
		NBTOutputStream nbtout = new NBTOutputStream(new FileOutputStream(new FileHandle(chunkPath + c.posx + " " + c.posy + ext).file()));
		//Write position into stream
		nbtout.writeTag(new IntTag("x", c.posx));
		nbtout.writeTag(new IntTag("y", c.posy));
		//Write pairs into stream
		HashMap<String, Tag> tiles = new HashMap<String, Tag>();
		for(int x = 0; x < References.chunkwidth; x++){
			for(int y = 0; y < References.chunkwidth; y++){
				HashMap<String, Tag> fore = new HashMap<String, Tag>();
				
				fore.put("id", new IntTag("id",c.tiles[x][y].foreground != null ? c.tiles[x][y].foreground.id.getIDValue() : 0));
				if(c.tiles[x][y].foreground != null)
					fore.put("meta", new CompoundTag("meta", c.tiles[x][y].foreground.saveNBT()));
				HashMap<String, Tag> back = new HashMap<String, Tag>();
				
				back.put("id", new IntTag("id",c.tiles[x][y].background != null ? c.tiles[x][y].background.id.getIDValue() : 0));
				if(c.tiles[x][y].background != null)
					back.put("meta", new CompoundTag("meta", c.tiles[x][y].background.saveNBT()));
				HashMap<String, Tag> pair = new HashMap<String, Tag>();
				
				pair.put("fore", new CompoundTag("fore", fore));
				pair.put("back", new CompoundTag("back", back));
				
				tiles.put(x+" "+y, new CompoundTag(x+" "+y, pair));
			}
		}
		nbtout.writeTag(new CompoundTag("tiles", tiles));
		nbtout.close();
	}