Unicopia/src/main/java/com/minelittlepony/unicopia/UnicopiaMixinPlugin.java
2023-08-17 17:04:51 +01:00

49 lines
1.5 KiB
Java

package com.minelittlepony.unicopia;
import java.util.List;
import java.util.Set;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import net.fabricmc.loader.api.FabricLoader;
public class UnicopiaMixinPlugin implements IMixinConfigPlugin {
private static final String MIXIN_PACKAGE = "com.minelittlepony.unicopia.mixin";
@Override
public void onLoad(String mixinPackage) { }
@Override
public String getRefMapperConfig() {
return null;
}
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (mixinClassName.startsWith(MIXIN_PACKAGE)) {
if (mixinClassName.indexOf("sodium") != -1) {
return FabricLoader.getInstance().isModLoaded("sodium");
}
if (mixinClassName.indexOf("trinkets") != -1) {
return FabricLoader.getInstance().isModLoaded("trinkets");
}
}
return true;
}
@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) { }
@Override
public List<String> 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) { }
}