net.minecraft.client.gui.GuiMainMenu Java Examples

The following examples show how to use net.minecraft.client.gui.GuiMainMenu. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinGuiDownloadTerrain.java    From LiquidBounce with GNU General Public License v3.0 7 votes vote down vote up
@Override
protected void injectedActionPerformed(GuiButton button) {
    if (button.id == 0) {
        boolean flag = this.mc.isIntegratedServerRunning();
        boolean flag1 = this.mc.isConnectedToRealms();
        button.enabled = false;
        this.mc.theWorld.sendQuittingDisconnectingPacket();
        this.mc.loadWorld(null);

        if (flag) {
            this.mc.displayGuiScreen(new GuiMainMenu());
        } else if (flag1) {
            RealmsBridge realmsbridge = new RealmsBridge();
            realmsbridge.switchToRealms(new GuiMainMenu());
        } else {
            this.mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
        }
    }

}
 
Example #2
Source File: EventHandler.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onActionPerformed(GuiScreenEvent.ActionPerformedEvent evt)
{
    if (evt.getGui() instanceof GuiMainMenu)
    {
        GuiMainMenuHandler.onActionPerformed(evt.getButton());
    }
}
 
Example #3
Source File: DisconnectCommand.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void exec(String input) {
    if (!this.clamp(input, 1, 1)) {
        this.printUsage();
        return;
    }

    final Minecraft mc = Minecraft.getMinecraft();

    boolean flag = mc.isIntegratedServerRunning();
    boolean flag1 = mc.isConnectedToRealms();
    mc.world.sendQuittingDisconnectingPacket();
    mc.loadWorld(null);

    if (flag) {
        mc.displayGuiScreen(new GuiMainMenu());
    }
    else if (flag1) {
        RealmsBridge realmsbridge = new RealmsBridge();
        realmsbridge.switchToRealms(new GuiMainMenu());
    } else {
        mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
    }
}
 
Example #4
Source File: GuiCustom.java    From Custom-Main-Menu with MIT License 6 votes vote down vote up
public void updateScreen()
{
	for (Image i : guiConfig.customImages)
	{
		if (i.ichBinEineSlideshow)
		{
			i.slideShow.update();
		}
	}

	if (guiConfig.background != null && guiConfig.background.ichBinEineSlideshow)
	{
		guiConfig.background.slideShow.update();
	}

	if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_R))
	{
		CustomMainMenu.INSTANCE.reload();

		if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
		{
			mc.refreshResources();
		}
		mc.displayGuiScreen(new GuiMainMenu());
	}
}
 
Example #5
Source File: CMMEventHandler.java    From Custom-Main-Menu with MIT License 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void openGui(GuiOpenEvent event)
{
	if (event.getGui() instanceof GuiMainMenu)
	{
		GuiCustom customMainMenu = CustomMainMenu.INSTANCE.config.getGUI("mainmenu");
		if (customMainMenu != null)
		{
			event.setGui(customMainMenu);
		}
	}
	else if (event.getGui() instanceof GuiCustom)
	{
		GuiCustom custom = (GuiCustom) event.getGui();

		GuiCustom target = CustomMainMenu.INSTANCE.config.getGUI(custom.guiConfig.name);
		if (target != custom)
		{
			event.setGui(target);
		}
	}
}
 
Example #6
Source File: ClientStateMachine.java    From malmo with MIT License 6 votes vote down vote up
@Override
protected void execute()
{
    totalTicks = 0;

    if (Minecraft.getMinecraft().world != null)
    {
        // If the Minecraft server isn't paused at this point,
        // then the following line will cause the server thread to exit...
        Minecraft.getMinecraft().world.sendQuittingDisconnectingPacket();
        // ...in which case the next line will hang.
        Minecraft.getMinecraft().loadWorld((WorldClient) null);
        // Must display the GUI or Minecraft will attempt to access a non-existent player in the client tick.
        Minecraft.getMinecraft().displayGuiScreen(new GuiMainMenu());

        // Allow shutdown messages to flow through.
        try {
            Thread.sleep(10000);
        } catch (InterruptedException ie) {
        }
    }
}
 
Example #7
Source File: MainMenuGuiService.java    From ForgeHax with MIT License 6 votes vote down vote up
@SubscribeEvent
public void onGui(GuiScreenEvent.InitGuiEvent.Post event) {
  if (event.getGui() instanceof GuiMainMenu) {
    GuiMainMenu gui = (GuiMainMenu) event.getGui();
    
    event
        .getButtonList()
        .stream()
        .skip(4) // skip first 4 button
        .forEach(
            button -> {
              button.y += 24;
            }); // lower the rest of the buttons to make room for ours
    
    event
        .getButtonList()
        .add(
            customButton =
                new GuiButton(
                    666,
                    gui.width / 2 - 100,
                    gui.height / 4 + 48 + (24 * 3), // put button in 4th row
                    "Command Input"));
  }
}
 
Example #8
Source File: MixinGuiDownloadTerrain.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void injectedActionPerformed(GuiButton button) {
    if (button.id == 0) {
        boolean flag = this.mc.isIntegratedServerRunning();
        boolean flag1 = this.mc.isConnectedToRealms();
        button.enabled = false;
        this.mc.theWorld.sendQuittingDisconnectingPacket();
        this.mc.loadWorld(null);

        if (flag) {
            this.mc.displayGuiScreen(new GuiMainMenu());
        } else if (flag1) {
            RealmsBridge realmsbridge = new RealmsBridge();
            realmsbridge.switchToRealms(new GuiMainMenu());
        } else {
            this.mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
        }
    }

}
 
Example #9
Source File: GuiConfirmDisconnect.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void actionPerformed(GuiButton button) {
    switch (button.id) {
        case 0:
            boolean integratedServerRunning = mc.isIntegratedServerRunning();
            button.enabled = false;
            mc.theWorld.sendQuittingDisconnectingPacket();
            mc.loadWorld(null);
            Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(integratedServerRunning ? new GuiMainMenu() : new GuiMultiplayer(new GuiMainMenu()));
            break;
        case 1:
            mc.displayGuiScreen(null);
            break;
    }
}
 
Example #10
Source File: GuiCrashScreen.java    From VanillaFix with MIT License 5 votes vote down vote up
@Override
protected void actionPerformed(GuiButton button) {
    super.actionPerformed(button);
    if (button.id == 0) {
        mc.displayGuiScreen(new GuiMainMenu());
    }
}
 
Example #11
Source File: ConnectCommand.java    From ClientBase with MIT License 5 votes vote down vote up
@Override
public void run(String alias, @NotNull String[] args) {
    if (args.length != 1) {
        throw new CommandException("Usage: ." + alias + " <server-address>");
    }

    // See https://github.com/Wurst-Imperium/Wurst-MC-1.12/blob/master/shared-src/net/wurstclient/bot/commands/JoinCmd.java
    Minecraft.getMinecraft().addScheduledTask(() -> Minecraft.getMinecraft().displayGuiScreen(new GuiConnecting(new GuiMainMenu(), Minecraft.getMinecraft(),
            new ServerData("", args[0], false))));
}
 
Example #12
Source File: ClientHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@SubscribeEvent
public void tickEvent(TickEvent.ClientTickEvent event) {
    if (event.phase == Phase.END) {
        return;
    }

    Minecraft mc = Minecraft.getMinecraft();
    if (mc.world != null) {
        if (loadWorld(mc.world)) {
            NEIClientConfig.setHasSMPCounterPart(false);
            NEIClientConfig.setInternalEnabled(false);

            if (!Minecraft.getMinecraft().isSingleplayer() && ClientUtils.inWorld())//wait for server to initiate in singleplayer
            {
                NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~'));
            }
        }

        if (!NEIClientConfig.isEnabled()) {
            return;
        }

        KeyManager.tickKeyStates();

        if (mc.currentScreen == null) {
            NEIController.processCreativeCycling(mc.player.inventory);
        }
    }

    GuiScreen gui = mc.currentScreen;
    if (gui != lastGui) {
        if (gui instanceof GuiMainMenu) {
            lastworld = null;
        } else if (gui instanceof GuiWorldSelection) {
            NEIClientConfig.reloadSaves();
        }
    }
    lastGui = gui;
}
 
Example #13
Source File: GuiTravelStandby.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public void updateScreen()
{
    super.updateScreen();

    m_ticks++;
    if( m_ticks == 30 )
    {
        ServerData serverData = new ServerData( "qCraft Transfer", m_destination.getAddress() );
        FMLClientHandler.instance().setupServerList();
        FMLClientHandler.instance().connectToServer( new GuiMainMenu(), serverData );
    }
}
 
Example #14
Source File: GuiTravelStandby.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
protected void actionPerformed( GuiButton button )
{
    if( button.id == 0 )
    {
        this.mc.displayGuiScreen( new GuiMainMenu() );
    }
}
 
Example #15
Source File: PlayerChunkViewer.java    From ChickenChunks with MIT License 5 votes vote down vote up
protected void startUpdateThread()
{
    new Thread("Info Frame Update Thread")
    {
        public void run()
        {
            while(true)
            {
                if(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu)
                    dispose();

                if(instance == null || !isVisible())
                    return;

                update();
                if(dialog != null)
                    dialog.update();

                try
                {
                    Thread.sleep(50);
                }
                catch(InterruptedException e)
                {
                }
            }
        }
    }.start();
}
 
Example #16
Source File: ActionRefresh.java    From Custom-Main-Menu with MIT License 5 votes vote down vote up
@Override
public void perform(Object source, GuiCustom menu)
{
	CustomMainMenu.INSTANCE.reload();

	if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
	{
		menu.mc.refreshResources();
	}
	menu.mc.displayGuiScreen(new GuiMainMenu());
}
 
Example #17
Source File: EventHandler.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiInit(GuiScreenEvent.InitGuiEvent evt)
{
    if (evt.getGui() instanceof GuiMainMenu)
    {
        IMCHandler.processMessages(FMLInterModComms.fetchRuntimeMessages(Reference.MOD_ID));
        GuiMainMenuHandler.initGui(evt.getGui(), evt.getButtonList());
    }
}
 
Example #18
Source File: HyperiumGuiMainMenu.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public HyperiumGuiMainMenu(GuiMainMenu parent) {
    this.parent = parent;
}
 
Example #19
Source File: WrapperGuiMainMenu.java    From ClientBase with MIT License 4 votes vote down vote up
public String getField_96138_a() {
    return GuiMainMenu.field_96138_a;
}
 
Example #20
Source File: ScreenHelper.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
    purgeExpiredFragments(null);
    if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu))
        return;
    if (Minecraft.getMinecraft().gameSettings.showDebugInfo)    // Don't obscure MC debug info with our debug info
        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;
                    }
                }
            }
        }
    }
}
 
Example #21
Source File: WrapperGuiMainMenu.java    From ClientBase with MIT License 4 votes vote down vote up
public GuiMainMenu unwrap() {
    return this.real;
}
 
Example #22
Source File: WrapperGuiMainMenu.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperGuiMainMenu(GuiMainMenu var1) {
    super(var1);
    this.real = var1;
}