public static void buildAssets(String directory) throws IOException {
        if (!(directory.endsWith("/")||directory.endsWith("\\"))) {
            //Logger.warning("Assets", "A slash was not added at the end of the asset output directory. Attempting to fix...");
            directory = directory + "/";
        }
        
        Logger.info("Assets", "Building Minecraft assets at " + directory);

        // Let's start by setting up the stuff we're gonna need
        Logger.info("Assets", "Setting up folders...");
        File assetFolder = new File(directory);
        try {
            FileUtils.deleteDirectory(assetFolder);
            Logger.info("Assets", "Deleting existing assets...");
        } catch (IOException e) {
            // Folder already exists
        }
        assetFolder.mkdir();
        File assetFolderLegacy = new File(directory + "/legacy");
        assetFolderLegacy.mkdir();

        // Now let's download the version definition file from Mojang and store it in a temporary file
        Logger.info("Assets", "Fetching asset definition file...");
        File defFile = File.createTempFile("assets", ".json");
        URL defWeb = new URL("https://s3.amazonaws.com/Minecraft.Download/indexes/legacy.json");
        FileUtils.copyURLToFile(defWeb, defFile);
        Logger.info("Assets", "Saving asset definition file...");
        File defFileSaved = new File(directory + "assetDef.json");
        FileUtils.copyFile(defFile, defFileSaved);

        // And now we parse...
        Logger.info("Assets", "String asset download...");
        String defString = FileUtils.readFileToString(defFile);
        StringReader defReader = new StringReader(defString);
        JsonReader reader = new JsonReader(defReader);
        try {
            reader.beginObject();
            reader.nextName();
            reader.nextBoolean();
            reader.nextName();
            reader.beginObject();
            boolean newFile = true;
            while (newFile) {
                String assetName = reader.nextName();
                reader.beginObject();
                reader.nextName();
                String hash = reader.nextString();
                String subhash = hash.substring(0, 2);
                Logger.info("Assets", "Downloading " + assetName + "...");
                URL asset = new URL("http://resources.download.minecraft.net/" + subhash + "/" + hash);
                File assetDest = new File(directory + "modern/" + subhash + "/" + hash);
                FileUtils.copyURLToFile(asset, assetDest);
                assetDest = new File(directory + "legacy/" + assetName);
                FileUtils.copyURLToFile(asset, assetDest);
                reader.nextName();
                reader.nextInt();
                reader.endObject();
                JsonToken next = reader.peek();
                newFile = next == JsonToken.NAME;
            }
            reader.endObject();
        } finally {
            reader.close();
            Logger.info("Assets", "Asset download completed");
        }
        
        Logger.info("Assets", "Deleting tempfiles...");
        boolean deleted = defFile.delete();
        if (!deleted) {
            Logger.warning("Assets", "Tempfile " + defFile.getAbsolutePath() + " failed to delete. Scheduling deletion upon termination of Moddle...");
            defFile.deleteOnExit();
        }
    }