Search in sources :

Example 1 with GuiWorldSelection

use of net.minecraft.client.gui.GuiWorldSelection in project Cavern2 by kegare.

the class ClientEventHooks method onGuiOpen.

@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    GuiScreen gui = event.getGui();
    if (gui != null && GuiModList.class == gui.getClass()) {
        String desc = I18n.format("cavern.description");
        if (!Strings.isNullOrEmpty(desc)) {
            Cavern.metadata.description = desc;
        }
    } else if (DisplayConfig.customLoadingScreen && CavernAPI.dimension.isInCaveDimensions(mc.player) && (mc.currentScreen == null || !(mc.currentScreen instanceof GuiWorldSelection))) {
        if (gui == null) {
            if (mc.currentScreen != null && GuiDownloadCaveTerrain.class == mc.currentScreen.getClass()) {
                event.setGui(new GuiLoadCaveTerrain());
            }
        } else if (GuiDownloadTerrain.class == gui.getClass()) {
            event.setGui(new GuiDownloadCaveTerrain());
        }
    }
}
Also used : GuiLoadCaveTerrain(cavern.client.gui.GuiLoadCaveTerrain) GuiWorldSelection(net.minecraft.client.gui.GuiWorldSelection) GuiDownloadCaveTerrain(cavern.client.gui.GuiDownloadCaveTerrain) GuiScreen(net.minecraft.client.gui.GuiScreen) GuiModList(net.minecraftforge.fml.client.GuiModList) TextComponentString(net.minecraft.util.text.TextComponentString) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with GuiWorldSelection

use of net.minecraft.client.gui.GuiWorldSelection in project BaseMetals by MinecraftModDevelopmentMods.

the class EventHandler method onUpdate.

/**
 * @param event
 */
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onUpdate(final TickEvent.RenderTickEvent event) {
    if ((Options.requireMMDOreSpawn()) && (Loader.isModLoaded("orespawn"))) {
        return;
    }
    if (!Options.fallbackOrespawn()) {
        return;
    }
    if (!Options.requireMMDOreSpawn()) {
        return;
    }
    final GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;
    if (guiscreen == null) {
        return;
    }
    final FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer;
    final int y = (guiscreen.height / 100) * 2;
    int x = (guiscreen.width / 2);
    if (guiscreen instanceof GuiMainMenu) {
        guiscreen.drawCenteredString(fontRender, "MMD OreSpawn not present, but requested in configuration, using fallback generator!", x, y, 0xffffff00);
    } else if (guiscreen instanceof GuiWorldSelection) {
        x = 10;
        final int widest = fontRender.getStringWidth("This is likely not what you want - try turning off the 'using_orespawn' option");
        final int shortest = fontRender.getStringWidth("Fallback Ore Spawn Generator Enabled!");
        int wrap = widest + 50;
        if ((guiscreen.width / 2) <= wrap) {
            wrap = shortest + 50;
        }
        fontRender.drawSplitString("Fallback Ore Spawn Generator Enabled!\nThis is likely not what you want - try turning off the 'using_orespawn' option\n(or install MMD OreSpawn)", x, y, wrap, 0xFFFFFF00);
    }
}
Also used : GuiWorldSelection(net.minecraft.client.gui.GuiWorldSelection) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) GuiScreen(net.minecraft.client.gui.GuiScreen) FontRenderer(net.minecraft.client.gui.FontRenderer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

GuiScreen (net.minecraft.client.gui.GuiScreen)2 GuiWorldSelection (net.minecraft.client.gui.GuiWorldSelection)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 GuiDownloadCaveTerrain (cavern.client.gui.GuiDownloadCaveTerrain)1 GuiLoadCaveTerrain (cavern.client.gui.GuiLoadCaveTerrain)1 Minecraft (net.minecraft.client.Minecraft)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 GuiMainMenu (net.minecraft.client.gui.GuiMainMenu)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 GuiModList (net.minecraftforge.fml.client.GuiModList)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1