From 3608b079d68b09867e276c9d59005fb0859ff6c8 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Mon, 27 May 2024 13:12:19 -0400 Subject: [PATCH] Move MixinExtras init earlier --- .../vintagefix/core/MixinConfigPlugin.java | 2 - .../core/MixinExtrasBootstrapPlugin.java | 47 +++++++++++++++++++ .../vintagefix/core/VintageFixCore.java | 2 +- .../resources/mixins.vintagefix.init.json | 18 +++++++ 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/embeddedt/vintagefix/core/MixinExtrasBootstrapPlugin.java create mode 100644 src/main/resources/mixins.vintagefix.init.json diff --git a/src/main/java/org/embeddedt/vintagefix/core/MixinConfigPlugin.java b/src/main/java/org/embeddedt/vintagefix/core/MixinConfigPlugin.java index 6c74787..7b39890 100644 --- a/src/main/java/org/embeddedt/vintagefix/core/MixinConfigPlugin.java +++ b/src/main/java/org/embeddedt/vintagefix/core/MixinConfigPlugin.java @@ -3,7 +3,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; -import com.llamalad7.mixinextras.MixinExtrasBootstrap; import net.minecraft.launchwrapper.Launch; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; @@ -99,7 +98,6 @@ private static void writeOrderedProperties(Properties props, OutputStream stream @Override public void onLoad(String s) { if(allMixins.size() == 0) { - MixinExtrasBootstrap.init(); try { URI uri = Objects.requireNonNull(MixinConfigPlugin.class.getResource("/mixins.vintagefix.json")).toURI(); FileSystem fs; diff --git a/src/main/java/org/embeddedt/vintagefix/core/MixinExtrasBootstrapPlugin.java b/src/main/java/org/embeddedt/vintagefix/core/MixinExtrasBootstrapPlugin.java new file mode 100644 index 0000000..8336d40 --- /dev/null +++ b/src/main/java/org/embeddedt/vintagefix/core/MixinExtrasBootstrapPlugin.java @@ -0,0 +1,47 @@ +package org.embeddedt.vintagefix.core; + +import com.llamalad7.mixinextras.MixinExtrasBootstrap; +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.Collections; +import java.util.List; +import java.util.Set; + +public class MixinExtrasBootstrapPlugin implements IMixinConfigPlugin { + @Override + public void onLoad(String s) { + MixinExtrasBootstrap.init(); + } + + @Override + public String getRefMapperConfig() { + return ""; + } + + @Override + public boolean shouldApplyMixin(String s, String s1) { + return false; + } + + @Override + public void acceptTargets(Set set, Set set1) { + + } + + @Override + public List getMixins() { + return Collections.emptyList(); + } + + @Override + public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { + + } + + @Override + public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { + + } +} diff --git a/src/main/java/org/embeddedt/vintagefix/core/VintageFixCore.java b/src/main/java/org/embeddedt/vintagefix/core/VintageFixCore.java index 609d29d..aa5d8d3 100644 --- a/src/main/java/org/embeddedt/vintagefix/core/VintageFixCore.java +++ b/src/main/java/org/embeddedt/vintagefix/core/VintageFixCore.java @@ -133,6 +133,6 @@ public List getMixinConfigs() { applyMixinFix(); mixinFixApplied = true; } - return ImmutableList.of("mixins.vintagefix.json"); + return ImmutableList.of("mixins.vintagefix.init.json", "mixins.vintagefix.json"); } } diff --git a/src/main/resources/mixins.vintagefix.init.json b/src/main/resources/mixins.vintagefix.init.json new file mode 100644 index 0000000..a7a1c23 --- /dev/null +++ b/src/main/resources/mixins.vintagefix.init.json @@ -0,0 +1,18 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "org.embeddedt.vintagefix.mixin", + "plugin": "org.embeddedt.vintagefix.core.MixinExtrasBootstrapPlugin", + "target": "@env(INIT)", + "compatibilityLevel": "JAVA_8", + "mixins": [ + ], + "client": [ + ], + "overwrites": { + "conformVisibility": true + }, + "injectors": { + "defaultRequire": 1 + } +}