public static Chunk loadChunk(GameMap map, String name, int posx, int posy) throws Exception {
		String chunkPath = path +"/"+ name +"/chunks/";
		if (!new FileHandle(chunkPath + posx + " " + posy + ext).exists())
			return null;
		NBTInputStream nbtin = new NBTInputStream(new FileInputStream(new FileHandle(chunkPath + posx + " " + posy + ext).file()));
		
		ArrayList<Tag> tags = new ArrayList<Tag>();
		Tag tag;
		try {
			while ((tag = nbtin.readTag()) != null) {
				tags.add(tag);
			}
		} catch (Exception e) { }
		
		Chunk c = new Chunk(posx, posy);
		
		Map<String, Tag> tiles =  ((CompoundTag) getTag(tags, "tiles")).getValue();
		
		for(int x = 0; x < References.chunkwidth; x++){
			for(int y = 0; y < References.chunkwidth; y++){
				Map<String, Tag> pair =  ((CompoundTag) tiles.get(x + " "+ y)).getValue();
				
				Map<String, Tag> fore =  ((CompoundTag) pair.get("fore")).getValue();
				Map<String, Tag> back =  ((CompoundTag) pair.get("back")).getValue();
				
				c.tiles[x][y].foreground = TileID.getTileFromID(((IntTag)fore.get("id")).getValue(), map, x, y, posx, posy, false);
				c.tiles[x][y].background = TileID.getTileFromID(((IntTag)back.get("id")).getValue(), map, x, y, posx, posy, true);
				
				if(c.tiles[x][y].foreground != null)
					c.tiles[x][y].foreground.loadNBT(((CompoundTag)fore.get("meta")).getValue());
				if(c.tiles[x][y].background != null)
					c.tiles[x][y].background.loadNBT(((CompoundTag)back.get("meta")).getValue());
			}
		}
		
		nbtin.close();
		
		return c;
	}