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);
}
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();
}
}
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;
}
}
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;
}
}
}
}
}
}
Aggregations