File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
fabric/src/main/java/dev/xdpxi/xdlib/api/v3 Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ package dev .xdpxi .xdlib .api .v3 ;
2
+
3
+ import net .fabricmc .loader .api .FabricLoader ;
4
+ import net .fabricmc .loader .api .ModContainer ;
5
+ import net .fabricmc .loader .api .metadata .ModMetadata ;
6
+
7
+ public class Loader {
8
+ public static boolean isModLoaded (String modID ) {
9
+ return FabricLoader .getInstance ().isModLoaded (modID );
10
+ }
11
+
12
+ public static String versionOfMod (String modID ) {
13
+ FabricLoader loader = FabricLoader .getInstance ();
14
+ ModContainer modContainer = loader .getModContainer (modID ).orElse (null );
15
+ if (modContainer != null ) {
16
+ ModMetadata metadata = modContainer .getMetadata ();
17
+ return metadata .getVersion ().getFriendlyString ();
18
+ }
19
+ return null ;
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments