use of net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent in project Cavern2 by kegare.
the class ClientEventHooks method onTick.
@SubscribeEvent
public void onTick(ClientTickEvent event) {
if (event.phase != TickEvent.Phase.END) {
return;
}
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc.currentScreen != null && mc.currentScreen instanceof GuiMainMenu && Config.configChecker.isUpdated() && !Config.configChecker.isNotified()) {
String line1 = I18n.format("cavern.config.message.update");
String line2 = I18n.format("cavern.config.message.open");
GuiScreen parentScreen = mc.currentScreen;
mc.displayGuiScreen(new GuiYesNo((result, id) -> {
if (result) {
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(CaveUtils.getModContainer());
GuiScreen guiConfig = guiFactory.createConfigGui(parentScreen);
mc.displayGuiScreen(guiConfig);
} else {
mc.displayGuiScreen(parentScreen);
}
}, line1, line2, -1));
Config.configChecker.setNotified(true);
}
if (!DELAYED_TOAST.isEmpty()) {
Iterator<DelayedToast> iterator = DELAYED_TOAST.iterator();
while (iterator.hasNext()) {
if (!iterator.next().onUpdate()) {
iterator.remove();
}
}
}
}
Aggregations