use of com.terraformersmc.modmenu.api.ModMenuApi in project MasaGadget by plusls.
the class MasaGuiUtil method initMasaModScreenList.
private static void initMasaModScreenList() {
initialised = true;
MinecraftClient client = MinecraftClient.getInstance();
if (!ModInfo.isModLoaded(ModInfo.MODMENU_MOD_ID)) {
return;
}
FabricLoader.getInstance().getEntrypointContainers("modmenu", ModMenuApi.class).forEach(entrypoint -> {
ModMetadata metadata = entrypoint.getProvider().getMetadata();
try {
ModMenuApi api = entrypoint.getEntrypoint();
Screen screen = api.getModConfigScreenFactory().create(client.currentScreen);
if (screen instanceof GuiConfigsBase) {
ConfigScreenFactory<?> configScreenFactory = api.getModConfigScreenFactory();
masaGuiData.put(configScreenFactory, metadata.getName());
masaGuiClassData.put(screen.getClass(), configScreenFactory);
}
} catch (Throwable e) {
ModInfo.LOGGER.error("Mod {} provides a broken implementation of ModMenuApi", metadata.getId(), e);
}
});
}
Aggregations