diff --git a/src/main/java/one/oth3r/sit/ModMenu.java b/src/main/java/one/oth3r/sit/ModMenu.java index 0d45772..bba82ea 100644 --- a/src/main/java/one/oth3r/sit/ModMenu.java +++ b/src/main/java/one/oth3r/sit/ModMenu.java @@ -21,6 +21,8 @@ public class ModMenu implements ModMenuApi { } @Override public ConfigScreenFactory getModConfigScreenFactory() { + // return null if YACL isn't installed to not throw an error + if (!yaclCheck()) return screen -> null; return parent -> YetAnotherConfigLib.createBuilder().save(Config::save) .title(Text.of("Sit!")) .category(ConfigCategory.createBuilder() @@ -198,4 +200,17 @@ public class ModMenu implements ModMenuApi { .build()) .build().generateScreen(parent); } + + /** + * check if YACL is installed by getting a class and seeing if it throws + * @return if YACL is installed + */ + public static boolean yaclCheck() { + try { + Class.forName("dev.isxander.yacl3.platform.fabric.YACLPlatformImpl"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } }