diff --git a/src/main/java/com/github/camotoy/bedrockskinutility/client/MixinConfigPlugin.java b/src/main/java/com/github/camotoy/bedrockskinutility/client/MixinConfigPlugin.java new file mode 100644 index 0000000..eb49037 --- /dev/null +++ b/src/main/java/com/github/camotoy/bedrockskinutility/client/MixinConfigPlugin.java @@ -0,0 +1,54 @@ +package com.github.camotoy.bedrockskinutility.client; + +import net.fabricmc.loader.api.FabricLoader; +import org.objectweb.asm.tree.ClassNode; +import org.slf4j.LoggerFactory; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; + +public class MixinConfigPlugin implements IMixinConfigPlugin { + + @Override + public void onLoad(String mixinPackage) { + + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + if (mixinClassName.equals("com.github.camotoy.bedrockskinutility.client.mixin.CapeFeatureRendererMixin")) { + boolean capes = FabricLoader.getInstance().getModContainer("capes").isPresent(); + if (capes) { + // the Capes mod has a Mixin that just sets all capes to transparent, so we don't need this Mixin + LoggerFactory.getLogger(MixinConfigPlugin.class).info("Disabling transparent cape mixin in BedrockSkinUtility as the Capes mod is also installed."); + return false; + } + } + return true; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) { + + } + + @Override + public List getMixins() { + return null; + } + + @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/src/main/resources/BedrockSkinUtility.mixins.json b/src/main/resources/BedrockSkinUtility.mixins.json index 51fb449..d7bb102 100644 --- a/src/main/resources/BedrockSkinUtility.mixins.json +++ b/src/main/resources/BedrockSkinUtility.mixins.json @@ -11,6 +11,7 @@ "PlayerEntityRendererChangeModel", "PlayerListEntryMixin" ], + "plugin": "com.github.camotoy.bedrockskinutility.client.MixinConfigPlugin", "injectors": { "defaultRequire": 1 }