From 72f7c0be1ffa210841d7c70685a82f10914f6fbf Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 30 Jun 2016 00:16:40 -0700 Subject: [PATCH] Forge will now load extra mods from mods/mod_list.json and mods/mc_version/mod_list.json. As defined by the same json spec as --modListFile. And now if repositoryRoot is prefixed with absolute: the path will NOT be relative to the MC directory. --- .../fml/relauncher/ModListHelper.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/relauncher/ModListHelper.java b/src/main/java/net/minecraftforge/fml/relauncher/ModListHelper.java index 1146d47868..6ecfb7d7cc 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/ModListHelper.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/ModListHelper.java @@ -62,12 +62,28 @@ public class ModListHelper { tryAddFile(modFile, null, modFile); } } + + String[] extras = new String[] + { + "mods/mod_list.json", + "mods/" + FMLInjectionData.mccversion + "/mod_list.json" + }; + + for (String extra : extras) + { + if ((new File(mcDirectory, extra)).exists()) + parseListFile(extra); + } + } private static void parseListFile(String listFile) { File f; try { - f = new File(mcDirectory, listFile).getCanonicalFile(); + if (listFile.startsWith("absolute:")) + f = new File(listFile.substring(9)).getCanonicalFile(); + else + f = new File(mcDirectory, listFile).getCanonicalFile(); } catch (IOException e2) { FMLRelaunchLog.log(Level.INFO, e2, "Unable to canonicalize path %s relative to %s", listFile, mcDirectory.getAbsolutePath());