Search in sources :

Example 1 with IModGuiFactory

use of net.minecraftforge.fml.client.IModGuiFactory 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();
            }
        }
    }
}
Also used : AquaCavernConfig(cavern.config.AquaCavernConfig) DisplayConfig(cavern.config.DisplayConfig) Keyboard(org.lwjgl.input.Keyboard) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) Config(cavern.config.Config) I18n(net.minecraft.client.resources.I18n) GuiDownloadCaveTerrain(cavern.client.gui.GuiDownloadCaveTerrain) GuiDownloadTerrain(net.minecraft.client.gui.GuiDownloadTerrain) Version(cavern.util.Version) Side(net.minecraftforge.fml.relauncher.Side) Cavern(cavern.core.Cavern) GuiMiningRecords(cavern.client.gui.GuiMiningRecords) ItemBowIce(cavern.item.ItemBowIce) DelayedToast(cavern.client.gui.toasts.DelayedToast) GlStateManager(net.minecraft.client.renderer.GlStateManager) CaveKeyBindings(cavern.client.CaveKeyBindings) EnchantmentHelper(net.minecraft.enchantment.EnchantmentHelper) GuiWorldSelection(net.minecraft.client.gui.GuiWorldSelection) CavernAPI(cavern.api.CavernAPI) List(java.util.List) CaveUtils(cavern.util.CaveUtils) FMLClientHandler(net.minecraftforge.fml.client.FMLClientHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemTooltipEvent(net.minecraftforge.event.entity.player.ItemTooltipEvent) FogColors(net.minecraftforge.client.event.EntityViewRenderEvent.FogColors) Configuration(net.minecraftforge.common.config.Configuration) TickEvent(net.minecraftforge.fml.common.gameevent.TickEvent) ClientConnectedToServerEvent(net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent) MobEffects(net.minecraft.init.MobEffects) MiningAssistConfig(cavern.config.MiningAssistConfig) PlayerLoggedInEvent(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent) IIceEquipment(cavern.api.IIceEquipment) GuiLoadCaveTerrain(cavern.client.gui.GuiLoadCaveTerrain) GuiModList(net.minecraftforge.fml.client.GuiModList) MiningAssist(cavern.miningassist.MiningAssist) ClickEvent(net.minecraft.util.text.event.ClickEvent) CavernConfig(cavern.config.CavernConfig) FogDensity(net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity) ClientTickEvent(net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent) GuiYesNo(net.minecraft.client.gui.GuiYesNo) ItemBowCavenic(cavern.item.ItemBowCavenic) CavelandConfig(cavern.config.CavelandConfig) ITextComponent(net.minecraft.util.text.ITextComponent) Strings(com.google.common.base.Strings) ItemStack(net.minecraft.item.ItemStack) Lists(com.google.common.collect.Lists) RenderGameOverlayEvent(net.minecraftforge.client.event.RenderGameOverlayEvent) Minecraft(net.minecraft.client.Minecraft) OnConfigChangedEvent(net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent) FOVUpdateEvent(net.minecraftforge.client.event.FOVUpdateEvent) MinerRank(cavern.stats.MinerRank) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) HugeCavernConfig(cavern.config.HugeCavernConfig) Entity(net.minecraft.entity.Entity) GeneralConfig(cavern.config.GeneralConfig) MirageWorldsConfig(cavern.config.MirageWorldsConfig) Iterator(java.util.Iterator) TextFormatting(net.minecraft.util.text.TextFormatting) CaveDimensions(cavern.world.CaveDimensions) MinerStats(cavern.stats.MinerStats) IModGuiFactory(net.minecraftforge.fml.client.IModGuiFactory) KeyInputEvent(net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent) TextComponentString(net.minecraft.util.text.TextComponentString) IBlockState(net.minecraft.block.state.IBlockState) GuiScreen(net.minecraft.client.gui.GuiScreen) CaveniaConfig(cavern.config.CaveniaConfig) Material(net.minecraft.block.material.Material) EntityLivingBase(net.minecraft.entity.EntityLivingBase) GuiOpenEvent(net.minecraftforge.client.event.GuiOpenEvent) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) RandomiteHelper(cavern.block.RandomiteHelper) IModGuiFactory(net.minecraftforge.fml.client.IModGuiFactory) GuiYesNo(net.minecraft.client.gui.GuiYesNo) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) DelayedToast(cavern.client.gui.toasts.DelayedToast) GuiScreen(net.minecraft.client.gui.GuiScreen) TextComponentString(net.minecraft.util.text.TextComponentString) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

CavernAPI (cavern.api.CavernAPI)1 IIceEquipment (cavern.api.IIceEquipment)1 RandomiteHelper (cavern.block.RandomiteHelper)1 CaveKeyBindings (cavern.client.CaveKeyBindings)1 GuiDownloadCaveTerrain (cavern.client.gui.GuiDownloadCaveTerrain)1 GuiLoadCaveTerrain (cavern.client.gui.GuiLoadCaveTerrain)1 GuiMiningRecords (cavern.client.gui.GuiMiningRecords)1 DelayedToast (cavern.client.gui.toasts.DelayedToast)1 AquaCavernConfig (cavern.config.AquaCavernConfig)1 CavelandConfig (cavern.config.CavelandConfig)1 CaveniaConfig (cavern.config.CaveniaConfig)1 CavernConfig (cavern.config.CavernConfig)1 Config (cavern.config.Config)1 DisplayConfig (cavern.config.DisplayConfig)1 GeneralConfig (cavern.config.GeneralConfig)1 HugeCavernConfig (cavern.config.HugeCavernConfig)1 MiningAssistConfig (cavern.config.MiningAssistConfig)1 MirageWorldsConfig (cavern.config.MirageWorldsConfig)1 Cavern (cavern.core.Cavern)1 ItemBowCavenic (cavern.item.ItemBowCavenic)1