diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-03-17 05:36:11 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-03-17 05:36:11 +0200 |
commit | c33015c87439e563ee953a57765bb7fa639c3b5f (patch) | |
tree | 6dc76fdece68f4c598614a547d6dcb0dc7a97e8f /src/main/java/shcm/shsupercm/fabric/citresewn/config | |
parent | 08168af5926129733b8f766b6a6eb24b6167fe01 (diff) | |
download | CITResewn-c33015c87439e563ee953a57765bb7fa639c3b5f.tar.gz CITResewn-c33015c87439e563ee953a57765bb7fa639c3b5f.tar.bz2 CITResewn-c33015c87439e563ee953a57765bb7fa639c3b5f.zip |
Set up compat mixin system and moved lbg compat
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/config')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java index ca0b149..bfabb8f 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java @@ -1,9 +1,12 @@ package shcm.shsupercm.fabric.citresewn.config; +import net.fabricmc.loader.api.FabricLoader; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; +import shcm.shsupercm.fabric.citresewn.CITResewn; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -20,6 +23,11 @@ public class CITResewnMixinConfiguration implements IMixinConfigPlugin { */ private boolean broken_paths; + /** + * Set of mod ids that had compatibility mixins loaded for them. + */ + private Set<String> compatMods = new HashSet<>(); + @Override public void onLoad(String mixinPackage) { CITResewnConfig launchConfig = CITResewnConfig.read(); @@ -36,6 +44,15 @@ public class CITResewnMixinConfiguration implements IMixinConfigPlugin { if (mixinClassName.startsWith("broken_paths")) return broken_paths; + if (mixinClassName.startsWith("compat.")) { + mixinClassName = mixinClassName.substring(7); + String modid = mixinClassName.substring(0, mixinClassName.indexOf('.')); + boolean loaded = FabricLoader.getInstance().isModLoaded(modid); + if (loaded && compatMods.add(modid)) + CITResewn.info("Loading compatibility for " + modid); + return loaded; + } + return true; } |