diff --git a/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperMod.java b/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperMod.java index 8149333..11bd375 100644 --- a/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperMod.java +++ b/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperMod.java @@ -30,6 +30,7 @@ public interface LaunchWrapperMod { * Returns an Injection which should dynamically create mappings, starting from an unobfuscated entry point * or you can return MappingSource.fromMappings(mappings) with predetermined mappings * This method must return an instance of MappingSource with all class/method/field mappings used by mixins from getMixins() + * This instance should also be the first Injection in a list returned by {@link #getInjections()} * @return Instance of MappingsSource */ @Nullable diff --git a/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperModFile.java b/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperModFile.java index 44af7f9..e811ac9 100644 --- a/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperModFile.java +++ b/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/LaunchWrapperModFile.java @@ -145,6 +145,7 @@ public LaunchWrapperModFile(File modLocation) throws IOException, InvalidMixinCo e.printStackTrace(); } } + injections.add(0, mappingSource); } } diff --git a/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/tweak/MicroMixinTweak.java b/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/tweak/MicroMixinTweak.java index 05338d8..66232c0 100644 --- a/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/tweak/MicroMixinTweak.java +++ b/launchwrapper-micromixin/src/main/java/org/mcphackers/launchwrapper/micromixin/tweak/MicroMixinTweak.java @@ -12,7 +12,6 @@ import org.mcphackers.launchwrapper.loader.LaunchClassLoader; import org.mcphackers.launchwrapper.micromixin.LaunchWrapperMod; import org.mcphackers.launchwrapper.micromixin.LaunchWrapperModFile; -import org.mcphackers.launchwrapper.micromixin.MappingSource; import org.mcphackers.launchwrapper.micromixin.tweak.injection.micromixin.MicroMixinInjection; import org.mcphackers.launchwrapper.micromixin.tweak.injection.micromixin.PackageAccessFixer; import org.mcphackers.launchwrapper.target.LaunchTarget; @@ -42,21 +41,19 @@ public MicroMixinTweak(LaunchConfig launch, Tweak tweak) { public void prepare(LaunchClassLoader loader) { File modDir = new File(config.gameDir.get(), "mods"); List modFiles = new ArrayList<>(); - URL url = loader.getResource("launchwrapper.mod.json"); - if (url != null) { - // TODO get all mods if multiple are on classpath - File f = Util.getSource(url, "launchwrapper.mod.json"); - modFiles.add(f); // Classpath mod has the highest priority - } + // Classpath mods have the highest priority + modFiles.addAll(Util.getSource(loader, "launchwrapper.mod.json")); if (modDir.isDirectory()) { List modList = Arrays.asList(modDir.listFiles()); modList.sort(Comparator.naturalOrder()); - modFiles.addAll(modList); + for (File f : modList) { + if (!f.getName().endsWith(".jar")) { + continue; + } + modFiles.add(f); + } } for (File f : modFiles) { - if (!f.getName().endsWith(".jar")) { - continue; - } try { LaunchWrapperMod mod = new LaunchWrapperModFile(f); mods.add(mod); @@ -86,10 +83,6 @@ public List getInjections() { List mods = getMixins(); List injects = new ArrayList(); for (LaunchWrapperMod mod : mods) { - MappingSource mappingSource = mod.getMappingSource(); - if (mappingSource != null) { - injects.add(mappingSource); - } injects.addAll(mod.getInjections()); } injects.addAll(baseTweak.getInjections());