Search in sources :

Example 1 with GuiMainMenu

use of net.minecraft.client.gui.GuiMainMenu in project MinecraftForge by MinecraftForge.

the class FMLClientHandler method connectToServerAtStartup.

public void connectToServerAtStartup(String host, int port) {
    setupServerList();
    ServerPinger osp = new ServerPinger();
    ServerData serverData = new ServerData("Command Line", host + ":" + port, false);
    try {
        osp.ping(serverData);
        startupConnectionData.await(30, TimeUnit.SECONDS);
    } catch (Exception e) {
        showGuiScreen(new GuiConnecting(new GuiMainMenu(), client, host, port));
        return;
    }
    connectToServer(new GuiMainMenu(), serverData);
}
Also used : GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) ServerData(net.minecraft.client.multiplayer.ServerData) GuiConnecting(net.minecraft.client.multiplayer.GuiConnecting) ServerPinger(net.minecraft.client.network.ServerPinger) WrongMinecraftVersionException(net.minecraftforge.fml.common.WrongMinecraftVersionException) DuplicateModsFoundException(net.minecraftforge.fml.common.DuplicateModsFoundException) LoaderException(net.minecraftforge.fml.common.LoaderException) IOException(java.io.IOException) ModSortingException(net.minecraftforge.fml.common.toposort.ModSortingException) MissingModsException(net.minecraftforge.fml.common.MissingModsException) Java8VersionException(net.minecraftforge.fml.common.Java8VersionException)

Example 2 with GuiMainMenu

use of net.minecraft.client.gui.GuiMainMenu in project MorePlanets by SteveKunG.

the class ClientEventHandler method onClientTick.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClientTick(ClientTickEvent event) {
    if (MorePlanetsCore.isObfuscatedEnvironment()) {
        if (Keyboard.isKeyDown(Keyboard.KEY_F7)) {
            try {
                // used for real time debugging item description
                Object proxy = Class.forName("mezz.jei.JustEnoughItems").getDeclaredMethod("getProxy").invoke(Class.forName("mezz.jei.startup.ProxyCommonClient"));
                Field pluginsField = proxy.getClass().getDeclaredField("plugins");
                pluginsField.setAccessible(true);
                Class<?> starter = Class.forName("mezz.jei.startup.JeiStarter");
                Object obj = starter.newInstance();
                Method method = obj.getClass().getDeclaredMethod("start", List.class);
                method.invoke(obj, (ArrayList<Object>) pluginsField.get(proxy));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5) && !this.mc.player.getHeldItemMainhand().isEmpty()) {
            this.mc.displayGuiScreen(new GuiGetItemName());
        }
    }
    if (ClientEventHandler.loadRenderers) {
        if (--this.loadRendererTick == 0) {
            MPLog.debug("Reload renderer");
            this.mc.renderGlobal.loadRenderers();
            this.loadRendererTick = 30;
            ClientEventHandler.loadRenderers = false;
        }
    }
    if (this.mc.player != null) {
        if (ConfigManagerMP.enableStartedPlanet && this.mc.player.dimension == -1 && this.mc.currentScreen instanceof GuiGameOver && !(this.mc.currentScreen instanceof GuiGameOverMP)) {
            this.mc.displayGuiScreen(new GuiGameOverMP());
        }
    }
    if (this.mc.currentScreen instanceof GuiMainMenu) {
        ClientEventHandler.receiverRenderPos.clear();
        ClientEventHandler.wasteRenderPos.clear();
        ClientEventHandler.entityId.clear();
        ClientEventHandler.bossList.clear();
        ClientEventHandler.itemRendererTicks = 0;
    }
    if (event.phase == Phase.START) {
        ClientEventHandler.itemRendererTicks++;
        this.partialTicks++;
        WeatherRendererNibiru.INSTANCE.runRenderTick();
        CloudRendererNibiru.INSTANCE.runRenderTick();
    }
}
Also used : Field(java.lang.reflect.Field) GuiGameOver(net.minecraft.client.gui.GuiGameOver) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) GuiGameOverMP(stevekung.mods.moreplanets.util.client.gui.GuiGameOverMP) Method(java.lang.reflect.Method) GuiGetItemName(stevekung.mods.moreplanets.util.debug.GuiGetItemName) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with GuiMainMenu

use of net.minecraft.client.gui.GuiMainMenu in project Almura by AlmuraDev.

the class SimpleIngameMenu method onButtonClick.

@Subscribe
public void onButtonClick(UIButton.ClickEvent event) throws IOException, URISyntaxException, AWTException {
    switch(event.getComponent().getName().toLowerCase(Locale.ENGLISH)) {
        case "button.back":
            this.close();
            break;
        case "button.shop":
            Desktop.getDesktop().browse(new URI(GuiConfig.Url.SHOP));
            break;
        case "button.guide":
            if (this.mc.player != null) {
                this.close();
            }
            break;
        case "button.instance":
            Desktop.getDesktop().browse(new URI(GuiConfig.Url.MAP));
            break;
        case "button.statistics":
            Desktop.getDesktop().browse(new URI(GuiConfig.Url.STATISTICS));
            break;
        case "button.advancements":
            close();
            if (this.mc.player != null) {
                this.mc.displayGuiScreen(new GuiScreenAdvancements(this.mc.player.connection.getAdvancementManager()));
            }
            break;
        case "button.forums":
            Desktop.getDesktop().browse(new URI(GuiConfig.Url.FORUM));
            break;
        case "button.lan":
            this.mc.displayGuiScreen(new GuiShareToLan(this));
            break;
        case "button.options":
            this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
            break;
        case "button.quit":
            close();
            this.mc.world.sendQuittingDisconnectingPacket();
            this.mc.loadWorld(null);
            this.mc.displayGuiScreen(new GuiMainMenu());
            break;
    }
}
Also used : GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) GuiScreenAdvancements(net.minecraft.client.gui.advancements.GuiScreenAdvancements) GuiShareToLan(net.minecraft.client.gui.GuiShareToLan) GuiOptions(net.minecraft.client.gui.GuiOptions) URI(java.net.URI) Subscribe(com.google.common.eventbus.Subscribe)

Example 4 with GuiMainMenu

use of net.minecraft.client.gui.GuiMainMenu in project malmo by Microsoft.

the class ScreenHelper method onRenderTick.

@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev) {
    purgeExpiredFragments(null);
    if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu))
        return;
    if (// Don't obscure MC debug info with our debug info
    Minecraft.getMinecraft().gameSettings.showDebugInfo)
        return;
    ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
    int width = res.getScaledWidth();
    int height = res.getScaledHeight();
    float rx = (float) width / 1000f;
    float ry = (float) height / 1000f;
    synchronized (this.fragments) {
        for (TextCategory cat : TextCategory.values()) {
            TextCategoryAttributes atts = this.attributes.get(cat);
            if (atts != null && (!atts.flashing || ((System.currentTimeMillis() / 500) % 3 != 0)) && shouldDisplay(atts.displayLevel)) {
                int x = Math.round(rx * (float) atts.xOrg);
                int y = Math.round(ry * (float) atts.yOrg);
                ArrayList<TextFragment> frags = this.fragments.get(cat);
                if (frags != null && !frags.isEmpty()) {
                    for (TextFragment frag : frags) {
                        drawText(frag.text, x, y, atts.colour);
                        y += 10;
                    }
                }
            }
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

GuiMainMenu (net.minecraft.client.gui.GuiMainMenu)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 Subscribe (com.google.common.eventbus.Subscribe)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 URI (java.net.URI)1 GuiGameOver (net.minecraft.client.gui.GuiGameOver)1 GuiOptions (net.minecraft.client.gui.GuiOptions)1 GuiShareToLan (net.minecraft.client.gui.GuiShareToLan)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 GuiScreenAdvancements (net.minecraft.client.gui.advancements.GuiScreenAdvancements)1 GuiConnecting (net.minecraft.client.multiplayer.GuiConnecting)1 ServerData (net.minecraft.client.multiplayer.ServerData)1 ServerPinger (net.minecraft.client.network.ServerPinger)1 DuplicateModsFoundException (net.minecraftforge.fml.common.DuplicateModsFoundException)1 Java8VersionException (net.minecraftforge.fml.common.Java8VersionException)1 LoaderException (net.minecraftforge.fml.common.LoaderException)1 MissingModsException (net.minecraftforge.fml.common.MissingModsException)1 WrongMinecraftVersionException (net.minecraftforge.fml.common.WrongMinecraftVersionException)1