diff --git a/fabric/src/main/java/dev/xdpxi/xdlib/api/v3/Loader.java b/fabric/src/main/java/dev/xdpxi/xdlib/api/v3/Loader.java new file mode 100644 index 0000000..a54289d --- /dev/null +++ b/fabric/src/main/java/dev/xdpxi/xdlib/api/v3/Loader.java @@ -0,0 +1,21 @@ +package dev.xdpxi.xdlib.api.v3; + +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.ModContainer; +import net.fabricmc.loader.api.metadata.ModMetadata; + +public class Loader { + public static boolean isModLoaded(String modID) { + return FabricLoader.getInstance().isModLoaded(modID); + } + + public static String versionOfMod(String modID) { + FabricLoader loader = FabricLoader.getInstance(); + ModContainer modContainer = loader.getModContainer(modID).orElse(null); + if (modContainer != null) { + ModMetadata metadata = modContainer.getMetadata(); + return metadata.getVersion().getFriendlyString(); + } + return null; + } +} \ No newline at end of file