Skip to content

Commit

Permalink
mod check util
Browse files Browse the repository at this point in the history
  • Loading branch information
ExDrill committed Oct 27, 2024
1 parent 6387eb7 commit d581ba2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/com/teamabode/guarding/Guarding.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.teamabode.sketch.core.api.config.ConfigManager;
import com.teamabode.sketch.core.api.event.ShieldEvents;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.resources.ResourceLocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -30,4 +31,8 @@ public void onInitialize() {
public static ResourceLocation id(String name) {
return ResourceLocation.fromNamespaceAndPath(MOD_ID, name);
}

public static boolean checkMod(String modId) {
return FabricLoader.getInstance().isModLoaded(modId);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.teamabode.guarding.core.mixin;

import com.teamabode.guarding.Guarding;
import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
Expand All @@ -12,7 +13,7 @@ public class GuardingMixinPlugin implements IMixinConfigPlugin {

public boolean shouldApplyMixin(String target, String mixin) {
// Compatibility with Fabric Shield Lib
if (FabricLoader.getInstance().isModLoaded("fabricshieldlib") && mixin.equals("ShieldEnchantabilityMixin")) {
if (Guarding.checkMod("fabricshieldlib") && mixin.contains("ShieldEnchantabilityMixin")) {
return false;
}
return true;
Expand Down

0 comments on commit d581ba2

Please sign in to comment.