diff --git a/src/main/java/org/violetmoon/zeta/annotation/Requirement.java b/src/main/java/org/violetmoon/zeta/annotation/Requirement.java index a0a9dd0..90272a5 100644 --- a/src/main/java/org/violetmoon/zeta/annotation/Requirement.java +++ b/src/main/java/org/violetmoon/zeta/annotation/Requirement.java @@ -14,9 +14,4 @@ * Versions | Doesnt work yet */ String[] versionPredicates() default {}; - - /** - * if true, then mixin is applied when x mod is present otherwise not - */ - boolean applyIfPresent() default true; } diff --git a/src/main/java/org/violetmoon/zeta/api/ConditionalMixinManager.java b/src/main/java/org/violetmoon/zeta/api/ConditionalMixinManager.java index 6b2871c..2785add 100644 --- a/src/main/java/org/violetmoon/zeta/api/ConditionalMixinManager.java +++ b/src/main/java/org/violetmoon/zeta/api/ConditionalMixinManager.java @@ -1,5 +1,6 @@ package org.violetmoon.zeta.api; +import org.jetbrains.annotations.ApiStatus; import org.objectweb.asm.Type; import org.objectweb.asm.tree.AnnotationNode; import org.spongepowered.asm.service.MixinService; @@ -11,6 +12,10 @@ import java.io.IOException; import java.util.List; +/** + * You are on your own using this; I do not understand what's going on here with the for loops lmao + */ +@ApiStatus.Internal public class ConditionalMixinManager { public static boolean shouldApply(Zeta zeta, String targetClassName, String mixinClassName) { try { @@ -23,12 +28,19 @@ public static boolean shouldApply(Zeta zeta, String targetClassName, String mixi List requirements = Annotations.getValue(node, "require", Requirement.class); for (Requirement req : requirements) { String[] modids = req.value(); - boolean applyIfPresent = req.applyIfPresent(); - boolean areModsLoaded = areModsLoaded(zeta, modids); + shouldApply = areModsLoaded(zeta, modids); - shouldApply = areModsLoaded == applyIfPresent; - Zeta.GLOBAL_LOG.info("{}: {} is{}being applied because the mod(s) {} are{}loaded", zeta.modid, targetClassName, shouldApply ? " " : " not ", modids, areModsLoaded ? " " : " not "); + Zeta.GLOBAL_LOG.info("{}: {} is{}being applied because the mod(s) {} are{}loaded", zeta.getModDisplayName(zeta.modid), targetClassName, shouldApply ? " " : " not ", modids, shouldApply ? " " : " not "); + } + + List conflicts = Annotations.getValue(node, "conflict", Requirement.class); + for (Requirement conflict : conflicts) { + String[] modids = conflict.value(); + + shouldApply = areModsLoaded(zeta, modids); + + Zeta.GLOBAL_LOG.info("{}: {} is{}being applied because the mod(s) {} are{}loaded", zeta.getModDisplayName(zeta.modid), targetClassName, shouldApply ? " " : " not ", modids, shouldApply ? " " : " not "); } } }