diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-28 18:49:57 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-28 18:49:57 +0700 |
commit | 96e5b8efc5092900f988335741db773f4108b806 (patch) | |
tree | 82a7d51c140c0f0b333d507756448025a231d944 /src/main/java/cc/polyfrost/oneconfig | |
parent | 324af98fa58a44ea64b3f841e6f73b827e80922d (diff) | |
download | OneConfig-96e5b8efc5092900f988335741db773f4108b806.tar.gz OneConfig-96e5b8efc5092900f988335741db773f4108b806.tar.bz2 OneConfig-96e5b8efc5092900f988335741db773f4108b806.zip |
fix --mixin arg
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java | 20 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/OneConfigTweaker.java | 13 |
2 files changed, 10 insertions, 23 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java b/src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java index 4d80f4d..3d924ac 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java @@ -4,32 +4,12 @@ import net.minecraft.launchwrapper.Launch; import org.spongepowered.asm.launch.MixinBootstrap; import org.spongepowered.asm.mixin.Mixins; -import java.io.File; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - @SuppressWarnings("unused") public class OneConfigInit { public static void initialize(String[] args) { Launch.blackboard.put("oneconfig.initialized", true); MixinBootstrap.init(); - if (Launch.blackboard.containsKey("oneconfig.wrapper.modFile")) { - try { - File modFile = (File) Launch.blackboard.get("oneconfig.wrapper.modFile"); - try (JarFile jarFile = new JarFile(modFile)) { - Manifest manifest = jarFile.getManifest(); - if (manifest != null) { - String mixinConfigs = manifest.getMainAttributes().getValue("MixinConfigs"); - if (mixinConfigs != null) { - Mixins.addConfiguration(mixinConfigs); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } Mixins.addConfiguration("mixins.oneconfig.json"); } } diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/OneConfigTweaker.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/OneConfigTweaker.java index 49a0197..8b822de 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/OneConfigTweaker.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/OneConfigTweaker.java @@ -7,6 +7,7 @@ import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraftforge.fml.relauncher.CoreModManager; import org.spongepowered.asm.launch.MixinBootstrap; import org.spongepowered.asm.launch.MixinTweaker; +import org.spongepowered.asm.mixin.Mixins; import java.io.File; import java.lang.reflect.Field; @@ -70,13 +71,21 @@ public class OneConfigTweaker implements ITweaker { @Override public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) { - + boolean captureNext = false; + for (String arg : args) { + if (captureNext) { + Mixins.addConfiguration(arg); + } + captureNext = "--mixin".equals(arg); + } } @Override public void injectIntoClassLoader(LaunchClassLoader classLoader) { removeLWJGLException(); Launch.classLoader.registerTransformer(ClassTransformer.class.getName()); + OneConfigInit.initialize(new String[]{}); + Launch.blackboard.put("oneconfig.init.initialized", true); Launch.classLoader.addClassLoaderExclusion("cc.polyfrost.oneconfig.internal.plugin.asm."); } @@ -90,8 +99,6 @@ public class OneConfigTweaker implements ITweaker { f_exceptions.setAccessible(true); Set<String> exceptions = (Set<String>) f_exceptions.get(Launch.classLoader); exceptions.remove("org.lwjgl."); - OneConfigInit.initialize(new String[]{}); - Launch.blackboard.put("oneconfig.init.initialized", true); } catch (Exception e) { throw new RuntimeException(e); } |