@SubscribeEvent public void onDraw(GuiScreenEvent.DrawScreenEvent.Post event) { if (event.gui instanceof GuiMainMenu || event.gui instanceof GuiIngameMenu) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); if (MoteCraft.mote == null) { this.mc.renderEngine.bindTexture(new ResourceLocation( MoteCraft.MODID, String.format("wiimote_search%02d.png", this.animstate / 3))); } else { this.mc.renderEngine.bindTexture(new ResourceLocation( MoteCraft.MODID, "wiimote_found.png")); } /* * this.drawTexturedModalRect( 0, 0, 0, 0, 230, 1000); */ Utils.drawTexturedQuadFit(10, 10, 32, 32, zLevel + 1); } }
@Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { if (args == null || args.length > 1 || args.length == 0) { return methodProxy.invokeSuper(obj, args); } if (method.getName().contains("guiRender") || method.getName().contains("mouseClick")) { Object arg0 = args[0]; if (arg0 instanceof GuiScreenEvent) { GuiScreenEvent drawEvent = (GuiScreenEvent) arg0; if (drawEvent.getGui() instanceof GuiMainMenu) { // Don't invoke. return methodProxy.getSignature().getReturnType().getOpcode(VOID); } } } return methodProxy.invokeSuper(obj, args); }
/** * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination */ public void onDisconnect(IChatComponent reason) { this.gameController.loadWorld((WorldClient)null); if (this.guiScreenServer != null) { if (this.guiScreenServer instanceof GuiScreenRealmsProxy) { this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy()); } else { this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason)); } } else { this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason)); } }
@Override public void initGui() { super.initGui(); // adjust position of options, quit & language buttons for(GuiButton button : buttonList) button.yPosition = Math.min(button.yPosition, height - 56); // notice noticeWidth1 = fontRendererObj.getStringWidth(noticeText); noticeWidth2 = fontRendererObj.getStringWidth(GuiMainMenu.MORE_INFO_TEXT); int noticeWidth = Math.max(noticeWidth1, noticeWidth2); noticeX1 = (width - noticeWidth) / 2; noticeY1 = buttonList.get(0).yPosition - 24; noticeX2 = noticeX1 + noticeWidth; noticeY2 = noticeY1 + 24; }
/** * Invoked when disconnecting, the parameter is a ChatComponent describing the * reason for termination */ public void onDisconnect(IChatComponent reason) { this.gameController.loadWorld((WorldClient) null); if (this.guiScreenServer != null) { if (this.guiScreenServer instanceof GuiScreenRealmsProxy) { this.gameController.displayGuiScreen( (new DisconnectedRealmsScreen(((GuiScreenRealmsProxy) this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy()); } else { this.gameController .displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason)); } } else { this.gameController.displayGuiScreen( new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason)); } }
/** * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination */ public void onDisconnect(ITextComponent reason) { this.gameController.loadWorld((WorldClient)null); if (this.guiScreenServer != null) { if (this.guiScreenServer instanceof GuiScreenRealmsProxy) { this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).getProxy(), "disconnect.lost", reason)).getProxy()); } else { this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason)); } } else { this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason)); } }
@Override public void load() { accountManager = new AccountManager(); mainMenuHook = new AltManagerMainMenuHook(); helpTextInfo = new Listener<RenderEverything>() { @Override public void call(RenderEverything event) { if (mc.currentScreen instanceof GuiMainMenu) { mc.fontRendererObj.drawStringWithShadow("Serenity (Community Edition) b" + BUILD_NUMBER, 2, 2, 0x07A4FE); mc.fontRendererObj.drawStringWithShadow("Press both shifts to show the account manager.", 2, 12, 0xFFFFFF); } } }; EventManager.register(mainMenuHook); EventManager.register(helpTextInfo); }
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); }
@SubscribeEvent public void onOpenGui(GuiOpenEvent event) { if (event.gui instanceof GuiMainMenu) { event.gui = new RewiMainMenu(); } if (event.gui instanceof GuiIngameMenu) { event.gui = new RewiIngameMenu(); } if (event.gui instanceof GuiOptions) { event.gui = new RewiOptionsMenu(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onGuiOpen(GuiOpenEvent event) { if(event.getGui() instanceof GuiMainMenu && !played) { played = true; if(playOn == 1 || playOn == 3) { SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(name)); if(sound != null) { Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float)pitch)); } else { logger.log(Level.WARN, "Could not find sound: %s", new ResourceLocation(name)); } } } }
public void connectToServerAtStartup(String host, int port) { setupServerList(); OldServerPinger osp = new OldServerPinger(); ServerData serverData = new ServerData("Command Line", host+":"+port); try { osp.func_147224_a(serverData); startupConnectionData.await(30, TimeUnit.SECONDS); } catch (Exception e) { showGuiScreen(new GuiConnecting(new GuiMainMenu(), client, host, port)); return; } connectToServer(new GuiMainMenu(), serverData); }
@SubscribeEvent public void onInitGuiScreen(GuiScreenEvent.InitGuiEvent.Post event) { if (active) { LabelButtonInfo.inject(event.getGui()); if (event.getGui() instanceof GuiIngameMenu) { event.getButtonList().add(new GuiButton(200, (event.getGui().width / 2) - 100, event.getGui().height - 20, I18n.format("gui.controller"))); } if (event.getGui() instanceof GuiMainMenu) { this.selector = new GuiButtonSelector(event.getGui().width / 2, event.getGui().height / 2 + 30, 40, event.getButtonList().toArray(new GuiButton[0])); event.getButtonList().clear(); } if (event.getButtonList().size() != 0) ActionButtonChange.moveMouse(new Wrapper(event.getButtonList().get(0)), event.getGui().width, event.getGui().height); } }
@SubscribeEvent public static void onGuiOpen(@Nonnull final GuiOpenEvent event) { if (!hasPlayed && event.getGui() instanceof GuiMainMenu) { hasPlayed = true; final String[] possibles = ModOptions.startupSoundList; if (possibles == null || possibles.length == 0) return; final String res = possibles[XorShiftRandom.current().nextInt(possibles.length)]; if (!StringUtils.isEmpty(res)) { final SoundEvent se = SoundEvent.REGISTRY.getObject(new ResourceLocation(res)); if (se != null) SoundEngine.instance().playSound(new AdhocSound(se, SoundCategory.MASTER)); else DSurround.log().warn("Unable to locate startup sound [%s]", res); } else { DSurround.log().warn("Improperly formatted startup sound list!"); } } }
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 ignored) { } } } }.start(); }
private void setSplashText( GuiMainMenu mainMenu, String str ) { try { Field[] fields = GuiMainMenu.class.getDeclaredFields(); for ( Field f : fields ) { f.setAccessible( true ); Object obj = f.get( mainMenu ); if ( obj instanceof String ) { f.set( mainMenu, str ); return; } } } catch ( Exception exception ) { } }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void textRenderEvent(RenderGameOverlayEvent.Text event) { if (keyBinding == null) return; if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu) { event.getLeft().add(NAME + " paused. Main menu open. If you want to AFK, use ALT+TAB."); } else if (Minecraft.getMinecraft().currentScreen instanceof GuiChat) { event.getLeft().add(NAME + " paused. Chat GUI open. If you want to AFK, use ALT+TAB."); } else { event.getLeft().add(NAME + " active: " + keyBinding.getDisplayName() + " (" + keyBinding.getKeyDescription().replaceFirst("^key\\.", "") + ')'); event.getLeft().add("Delay: " + i + " / " + delay); } }
public void onDisconnect(IChatComponent p_147231_1_) { this.gameController.loadWorld((WorldClient)null); if (this.guiScreenServer != null) { if (this.guiScreenServer instanceof GuiScreenRealmsProxy) { this.gameController.displayGuiScreen((new DisconnectedOnlineScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", p_147231_1_)).getProxy()); } else { this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", p_147231_1_)); } } else { this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", p_147231_1_)); } }
public void onRenderTick() { GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen; if (guiscreen == null && mod_Avatar.data.Chi != -1) { FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Chi: " + mod_Avatar.data.Chi, 0, 1, 16777215); } if (guiscreen == null && mod_Avatar.data.pshow){ FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Moves: " + mod_Avatar.data.pmoves, 0, 41, 16777215); } if (guiscreen instanceof GuiMainMenu) { if(mod_Avatar.data.updateAvailable){ FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Avatar The Last Blockbender " + mod_Avatar.version + " - UPDATE AVAILABLE!", 10, 10, 0xFF0000); } else{ FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Avatar The Last Blockbender " + mod_Avatar.version, 10, 10, 0xFF0000); } } if (guiscreen == null) { if(mod_Avatar.data.showHelp){ renderHelpInfo(); } renderFamiliarInfo(); } }
@SubscribeEvent public void onOpenGui(GuiOpenEvent evt) { GuiScreen gui = evt.getGui(); if (gui instanceof GuiMainMenu) { try { GuiMainMenu menu = (GuiMainMenu) gui; String splash = mainMenuGetSplashText(menu); if (splash.equals("Kind of dragon free!")) { splash = "Not really dragon free!"; mainMenuSetSplashText(menu, splash); } else if (splashLines != null && !splashLines.isEmpty() && rand.nextInt(10) == 0) { splash = splashLines.get(rand.nextInt(splashLines.size())); mainMenuSetSplashText(menu, splash); } } catch (Throwable t) { L.warn("Can't override splash", t); } } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void openMainMenu(GuiOpenEvent e) { if (e.gui instanceof GuiMainMenu && Config.replacements.isEmpty() && Config.itemReplacements.isEmpty()) { File file = new File(configDir, Refs.MOD_ID + "_data"); if (!file.exists()) { try { file.createNewFile(); } catch (Throwable t) { TooManyDanyOres.logger.warn("Unable to create a data file!"); TooManyDanyOres.logger.catching(t); } e.gui = new GuiStartupWarning((GuiMainMenu)e.gui); MinecraftForge.EVENT_BUS.unregister(this); } } }
public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) { if (!this.disconnected) { this.disconnected = true; this.mc.loadWorld((WorldClient)null); if (this.field_98183_l != null) { this.mc.displayGuiScreen(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.lost", par1Str, par2ArrayOfObj)); } else { this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", par1Str, par2ArrayOfObj)); } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onGui(GuiOpenEvent event) { if (event.gui instanceof GuiMainMenu) { if (shouldLoadGUI && ConfigurationHandler.showIRCGui) { event.gui = new IRCGui(); shouldLoadGUI = false; } else { ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu) event.gui, getRandTPPISplash(), "splashText", "field_73975_c"); } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { if(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu && !(Minecraft.getMinecraft().currentScreen instanceof GuiAnimationMainMenu)) Minecraft.getMinecraft().displayGuiScreen(new GuiAnimationMainMenu()); if(Minecraft.getMinecraft().inGameHasFocus && Minecraft.getMinecraft().currentScreen == null && Minecraft.getMinecraft().getIntegratedServer().worlds[0].getWorldInfo().getWorldName().equals("animation_world")) { Minecraft.getMinecraft().displayGuiScreen(new GuiBlack()); new HomeFrame().display(); } }
public void onUpdate() { ProgressBarList.render(); if (thread.getState() == Thread.State.NEW) thread.start(); else if (thread.getState() == Thread.State.TERMINATED && !managers.getLoading() && !managers.getEndLoading()) { managers.loadManagers(); managers.getManager(EventManager.class).register(this); } else if (managers.getEndLoading()) Minecraft.getMinecraft().displayGuiScreen(new GuiMainMenu()); }
private void updateMainMenu(GuiMainMenu p_updateMainMenu_1_) { try { String s = null; Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); int i = calendar.get(5); int j = calendar.get(2) + 1; if (i == 8 && j == 4) { s = "Happy birthday, OptiFine!"; } if (i == 14 && j == 8) { s = "Happy birthday, sp614x!"; } if (s == null) { return; } Field[] afield = GuiMainMenu.class.getDeclaredFields(); for (int k = 0; k < afield.length; ++k) { if (afield[k].getType() == String.class) { afield[k].setAccessible(true); afield[k].set(p_updateMainMenu_1_, s); break; } } } catch (Throwable var8) { ; } }
@Override protected void execute() { if (Minecraft.getMinecraft().theWorld != null) { // If the Minecraft server isn't paused at this point, // then the following line will cause the server thread to exit... Minecraft.getMinecraft().theWorld.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()); } }
@SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent ev) { purgeExpiredFragments(null); if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu)) return; int displayWidth = Minecraft.getMinecraft().displayWidth; int displayHeight = Minecraft.getMinecraft().displayHeight; ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft(), displayWidth, displayHeight); 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; } } } } } }
@CoreEvent public void draw(final DrawScreenEvent.Post e) { final GuiScreen gui = this.mc.currentScreen; if (gui instanceof GuiMultiplayer) { } else if (gui instanceof GuiDisconnected) { if (this.disableBackButton!=null&&Config.getConfig().durationDisconnected.get()>=10) this.disableBackButton.displayString = I18n.format("serverobserver.gui.backandstop.time", I18n.format("serverobserver.gui.backandstop"), timeremain()); } else if (gui instanceof GuiMainMenu) { final GuiButton button = this.mainMenuButtonMulti; if (button!=null&&this.target.getIP()!=null&&!this.manualOpen) button.displayString = I18n.format("serverobserver.gui.maintomulti.time", I18n.format("menu.multiplayer"), timeremain()); } }