mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
fix ModMenu error if YACL isn't installed
This commit is contained in:
parent
02dd4e868c
commit
890216a19a
1 changed files with 15 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue