aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/OneConfigTweaker.java13
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);
}