diff --git a/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridge.java b/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridge.java index 2d3bdd7..4616b40 100644 --- a/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridge.java +++ b/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridge.java @@ -8,9 +8,10 @@ @Mod("connectorextras_emi_bridge") public class EMIBridge { private static final Logger LOGGER = LogUtils.getLogger(); + public static final String EMI_MODID = "emi"; public static void injectModule() { LOGGER.info("Injecting EMI API classes"); - HackyModuleInjector.injectModuleSources("emi", EMIBridge.class.getResource("/relocate")); + HackyModuleInjector.injectModuleSources(EMI_MODID, EMIBridge.class.getResource("/relocate")); } } diff --git a/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridgeMixinPlugin.java b/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridgeMixinPlugin.java new file mode 100644 index 0000000..b4269ed --- /dev/null +++ b/emi-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/emibridge/EMIBridgeMixinPlugin.java @@ -0,0 +1,42 @@ +package dev.su5ed.sinytra.connectorextras.emibridge; + +import com.google.common.base.Suppliers; +import net.minecraftforge.fml.loading.LoadingModList; +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; + +public class EMIBridgeMixinPlugin implements IMixinConfigPlugin { + private static final Supplier EMI_LOADED = Suppliers.memoize(() -> LoadingModList.get().getModFileById(EMIBridge.EMI_MODID) != null); + + @Override + public void onLoad(String mixinPackage) {} + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return EMI_LOADED.get(); + } + + @Override + public List getMixins() { + return null; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) {} + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} +} diff --git a/emi-bridge/src/main/resources/mixins.emibridge.json b/emi-bridge/src/main/resources/mixins.emibridge.json index 25eca6b..4fe0a9e 100644 --- a/emi-bridge/src/main/resources/mixins.emibridge.json +++ b/emi-bridge/src/main/resources/mixins.emibridge.json @@ -3,6 +3,7 @@ "compatibilityLevel": "JAVA_16", "required": true, "package": "dev.su5ed.sinytra.connectorextras.emibridge.mixin", + "plugin": "dev.su5ed.sinytra.connectorextras.emibridge.EMIBridgeMixinPlugin", "mixins": [ "EmiAgnosForgeMixin", "MainEntrypointMixin" diff --git a/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridge.java b/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridge.java index 1b7f6e5..2089ef2 100644 --- a/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridge.java +++ b/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridge.java @@ -4,5 +4,5 @@ @Mod("connectorextras_rei_bridge") public class REIBridge { - + public static final String REI_MODID = "roughlyenoughitems"; } diff --git a/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridgeMixinPlugin.java b/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridgeMixinPlugin.java new file mode 100644 index 0000000..eaf6ebc --- /dev/null +++ b/rei-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/reibridge/REIBridgeMixinPlugin.java @@ -0,0 +1,42 @@ +package dev.su5ed.sinytra.connectorextras.reibridge; + +import com.google.common.base.Suppliers; +import net.minecraftforge.fml.loading.LoadingModList; +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; + +public class REIBridgeMixinPlugin implements IMixinConfigPlugin { + private static final Supplier REI_LOADED = Suppliers.memoize(() -> LoadingModList.get().getModFileById(REIBridge.REI_MODID) != null); + + @Override + public void onLoad(String mixinPackage) {} + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return REI_LOADED.get(); + } + + @Override + public List getMixins() { + return null; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) {} + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} +} diff --git a/rei-bridge/src/main/resources/mixins.reibridge.json b/rei-bridge/src/main/resources/mixins.reibridge.json index 2c69678..304adce 100644 --- a/rei-bridge/src/main/resources/mixins.reibridge.json +++ b/rei-bridge/src/main/resources/mixins.reibridge.json @@ -3,6 +3,7 @@ "compatibilityLevel": "JAVA_16", "required": true, "package": "dev.su5ed.sinytra.connectorextras.reibridge.mixin", + "plugin": "dev.su5ed.sinytra.connectorextras.reibridge.REIBridgeMixinPlugin", "client": [ "client.RoughlyEnoughItemsCoreClientMixin" ],