private static File syncAssets(File assetDir, String indexName) throws JsonSyntaxException, JsonIOException, IOException
	{
	    Logger.logInfo("Syncing Assets:");
	    File objects = new File(assetDir, "objects");
	    AssetIndex index = JsonFactory.loadAssetIndex(new File(assetDir, "indexes/{INDEX}.json".replace("{INDEX}", indexName)));
	    
	    if (!index.virtual)
	        return assetDir;

        File targetDir = new File(assetDir, "virtual/" + indexName);
        
	    Set<File> old = FileUtils.listFiles(targetDir);
	    
	    for (Entry<String, Asset> e : index.objects.entrySet())
	    {
	        Asset asset = e.getValue();
	        File local = new File(targetDir, e.getKey());
	        File object = new File(objects, asset.hash.substring(0, 2) + "/" + asset.hash);

            old.remove(local);
	        
	        if (local.exists() && !DownloadUtils.fileSHA(local).equals(asset.hash))
	        {
	            Logger.logInfo("  Changed: " + e.getKey());
	            FileUtils.copyFile(object, local, true);
	        }
	        else if (!local.exists())
	        {
                Logger.logInfo("  Added: " + e.getKey());
                FileUtils.copyFile(object, local);
	        }
	    }

	    for (File f : old)
	    {
	        String name = f.getAbsolutePath().replace(targetDir.getAbsolutePath(), "");
	        Logger.logInfo("  Removed: " + name.substring(1));
	        f.delete();
	    }

	    return targetDir;
	}