@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; }
@SubscribeEvent @SideOnly(Side.CLIENT) //Modders should never do this, im just lazy, and I KNOW what im doing. public void onOpenGui(GuiOpenEvent e) { //If we're opening the new world screen from the world selection, default to void world. if (e.getGui() instanceof GuiCreateWorld && Minecraft.getMinecraft().currentScreen instanceof GuiWorldSelection) { //Auto-select void world. GuiCreateWorld cw = (GuiCreateWorld)e.getGui(); ReflectionHelper.setPrivateValue(GuiCreateWorld.class, cw, worldType.getId(), "field_146331_K", "selectedIndex"); } }
/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { if (button.id == 0) { this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); } if (button.id == 5) { this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager())); } if (button.id == 1) { this.mc.displayGuiScreen(new GuiWorldSelection(this)); } if (button.id == 2) { this.mc.displayGuiScreen(new GuiMultiplayer(this)); } if (button.id == 4) { this.mc.shutdown(); } if (button.id == 11) { this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); } if (button.id == 12) { ISaveFormat isaveformat = this.mc.getSaveLoader(); WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World"); if (worldinfo != null) { this.mc.displayGuiScreen(new GuiYesNo(this, I18n.format("selectWorld.deleteQuestion", new Object[0]), "\'" + worldinfo.getWorldName() + "\' " + I18n.format("selectWorld.deleteWarning", new Object[0]), I18n.format("selectWorld.deleteButton", new Object[0]), I18n.format("gui.cancel", new Object[0]), 12)); } } if (button.id == 21) { this.mc.displayGuiScreen(new CheataGui(this)); } if (button.id == 24) { try { final URL url = new URL("https://github.com/CheataClient/CheataClient"); URI uri = url.toURI(); Desktop.getDesktop().browse(uri); } catch (URISyntaxException e) { e.printStackTrace(); } } }
@SubscribeEvent public void onGuiOpen(GuiOpenEvent e){ if(e.getGui() != null && e.getGui().getClass() == GuiWorldSelection.class){ e.setGui(new NewWorldSelector()); } }