add null check for modid when registering modmenu screens
This commit is contained in:
@@ -30,6 +30,8 @@ public class OmegaConfigGui {
|
|||||||
*/
|
*/
|
||||||
public static <T extends Config> void registerConfigScreen(T config) {
|
public static <T extends Config> void registerConfigScreen(T config) {
|
||||||
if(FabricLoader.getInstance().isModLoaded("modmenu")) {
|
if(FabricLoader.getInstance().isModLoaded("modmenu")) {
|
||||||
|
// Ensure the config has a valid modid.
|
||||||
|
if(config.getModid() != null) {
|
||||||
OmegaScreenFactory<Screen> factory = OmegaConfigGui.getConfigScreenFactory(config);
|
OmegaScreenFactory<Screen> factory = OmegaConfigGui.getConfigScreenFactory(config);
|
||||||
|
|
||||||
if(modMenuInitialized) {
|
if(modMenuInitialized) {
|
||||||
@@ -37,6 +39,9 @@ public class OmegaConfigGui {
|
|||||||
} else {
|
} else {
|
||||||
REGISTERED_CONFIGURATIONS.put(config, factory);
|
REGISTERED_CONFIGURATIONS.put(config, factory);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
OmegaConfig.LOGGER.warn(String.format("Skipping config screen registration for '%s' - you must implement getModid() in your config class!", config.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user