aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-12 17:21:28 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-12 17:21:28 +0700
commitda5288bd5c80611acfeb1ebe33af1860f27f23fc (patch)
treed0b14a9d13f6af7d7a0bf8f551d575ccbef5d2e3 /src
parentb41e6fd6cbfee6b3b31855447f9ba79d68846e4e (diff)
downloadOneConfig-da5288bd5c80611acfeb1ebe33af1860f27f23fc.tar.gz
OneConfig-da5288bd5c80611acfeb1ebe33af1860f27f23fc.tar.bz2
OneConfig-da5288bd5c80611acfeb1ebe33af1860f27f23fc.zip
a little trolling
Diffstat (limited to 'src')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java20
1 files changed, 20 insertions, 0 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 3d924ac..4d80f4d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/init/OneConfigInit.java
@@ -4,12 +4,32 @@ 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");
}
}