/** * 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 run() { while (true) { if (NetworkUtils.this.mc.getCurrentServerData() != null) { try { if (NetworkUtils.this.mc.currentScreen == null || !(NetworkUtils.this.mc.currentScreen instanceof GuiMultiplayer)) { NetworkUtils.this.pinger.ping(NetworkUtils.this.mc.getCurrentServerData()); } } catch (UnknownHostException ex) {} } try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } } }
/** * 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 onUpdate() { if(mc.thePlayer.getHealth() <= leaveHealth){ boolean flag = this.mc.isIntegratedServerRunning(); boolean flag1 = this.mc.isConnectedToRealms(); this.mc.theWorld.sendQuittingDisconnectingPacket(); this.mc.loadWorld((WorldClient)null); if (flag) { this.mc.displayGuiScreen(new CheataMainMenu()); } else if (flag1) { RealmsBridge realmsbridge = new RealmsBridge(); realmsbridge.switchToRealms(new CheataMainMenu()); } else { this.mc.displayGuiScreen(new GuiMultiplayer(new CheataMainMenu())); } } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if(type.contains(TickType.RENDER)){ if(Minecraft.getMinecraft().currentScreen != null && Minecraft.getMinecraft().currentScreen instanceof GuiMultiplayer){ lastScreen = Minecraft.getMinecraft().currentScreen; int x = lastScreen.width / 1 - 210; int y = lastScreen.height / 4 - 65; List buttonList = getButtonList(lastScreen); boolean hasMumButton = false; for(Object o : buttonList){ if(o instanceof HCGuiServerButton){ hasMumButton = true; break; } } if(!hasMumButton){ buttonList.add(new HCGuiServerButton(99, x, y, lastScreen)); } } } }
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_)); } }
protected void func_77213_a(int p_77213_1_, boolean p_77213_2_) { if(p_77213_1_ < GuiMultiplayer.func_74006_a(this.field_77250_a).func_78856_c() + GuiMultiplayer.func_74003_b(this.field_77250_a).size()) { int var3 = GuiMultiplayer.func_74020_c(this.field_77250_a); GuiMultiplayer.func_74015_a(this.field_77250_a, p_77213_1_); ServerData var4 = GuiMultiplayer.func_74006_a(this.field_77250_a).func_78856_c() > p_77213_1_?GuiMultiplayer.func_74006_a(this.field_77250_a).func_78850_a(p_77213_1_):null; boolean var5 = GuiMultiplayer.func_74020_c(this.field_77250_a) >= 0 && GuiMultiplayer.func_74020_c(this.field_77250_a) < this.func_77217_a() && (var4 == null || var4.field_82821_f == 78); boolean var6 = GuiMultiplayer.func_74020_c(this.field_77250_a) < GuiMultiplayer.func_74006_a(this.field_77250_a).func_78856_c(); GuiMultiplayer.func_74014_d(this.field_77250_a).field_73742_g = var5; GuiMultiplayer.func_74005_e(this.field_77250_a).field_73742_g = var6; GuiMultiplayer.func_74019_f(this.field_77250_a).field_73742_g = var6; if(p_77213_2_ && var5) { GuiMultiplayer.func_74008_b(this.field_77250_a, p_77213_1_); } else if(var6 && GuiScreen.func_73877_p() && var3 >= 0 && var3 < GuiMultiplayer.func_74006_a(this.field_77250_a).func_78856_c()) { GuiMultiplayer.func_74006_a(this.field_77250_a).func_78857_a(var3, GuiMultiplayer.func_74020_c(this.field_77250_a)); } } }
private void func_77249_c(int p_77249_1_, int p_77249_2_, int p_77249_3_, int p_77249_4_, Tessellator p_77249_5_) { this.field_77250_a.func_73732_a(this.field_77250_a.field_73886_k, I18n.func_135053_a("lanServer.scanning"), this.field_77250_a.field_73880_f / 2, p_77249_3_ + 1, 16777215); String var6; switch(GuiMultiplayer.func_74010_g(this.field_77250_a) / 3 % 4) { case 0: default: var6 = "O o o"; break; case 1: case 3: var6 = "o O o"; break; case 2: var6 = "o o O"; } this.field_77250_a.func_73732_a(this.field_77250_a.field_73886_k, var6, this.field_77250_a.field_73880_f / 2, p_77249_3_ + 12, 8421504); }
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)); } } }
@Override protected void actionPerformed(GuiButton button) { switch (button.id) { case 1: // Singleplayer RenderUtil.MINECRAFT.displayGuiScreen(new GuiSelectWorld(this)); break; case 2: // Multiplayer RenderUtil.MINECRAFT.displayGuiScreen(new GuiMultiplayer(this)); break; case 3: // Options RenderUtil.MINECRAFT.displayGuiScreen(new GuiOptions(this, RenderUtil.MINECRAFT.gameSettings)); break; case 4: // Mods RenderUtil.MINECRAFT.displayGuiScreen(new GuiModList(this)); break; case 5: // Addons break; case 6: // Quit RenderUtil.MINECRAFT.shutdown(); } }
protected CreeperHostEntry(GuiMultiplayer p_i45048_1_, ServerData serverIn) { super(p_i45048_1_, serverIn); serverIcon = Config.getInstance().isServerHostMenuImage() ? CreeperHost.instance.getImplementation().getMenuIcon() : new ResourceLocation("creeperhost", "textures/nobrandmp.png"); cross = new String(Character.toChars(10006)); stringWidth = this.mc.fontRenderer.getStringWidth(cross); }
/** * Called when the mouse is clicked within this entry. Returning true means that something within this entry was * clicked and the list should not be dragged. */ public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int x, int y) { if (x >= 303 - stringWidth - 2 && x <= 303 - 3 && y >= 0 && y <= 7) { Config.getInstance().setMpMenuEnabled(false); CreeperHost.instance.saveConfig(); this.mc.displayGuiScreen(new GuiMultiplayer(null)); return true; } Minecraft.getMinecraft().displayGuiScreen(GuiGetServer.getByStep(0, new Order())); return true; }
@Override protected void actionPerformed(GuiButton button) { if (button == this.buttonPrev) { this.mc.displayGuiScreen(getByStep(this.stepId - 1, this.order)); } else if (button == this.buttonNext) { if (this.stepId + 1 == STEP_AMOUNT) { this.mc.displayGuiScreen(new GuiMultiplayer(null)); } else { this.mc.displayGuiScreen(getByStep(this.stepId + 1, this.order)); } } else if (button == this.buttonCancel) { this.mc.displayGuiScreen(null); } else { super.actionPerformed(button); } }
protected CreeperHostEntry(GuiMultiplayer p_i45048_1_, ServerData serverIn) { super(p_i45048_1_, serverIn); ourMP = p_i45048_1_; serverIcon = Config.getInstance().isServerHostMenuImage() ? CreeperHost.instance.getImplementation().getMenuIcon() : new ResourceLocation("creeperhost", "textures/nobrandmp.png"); cross = new String(Character.toChars(10006)); stringWidth = this.mc.fontRendererObj.getStringWidth(cross); }
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int x, int y) { if (x >= 303 - stringWidth - 2 && x <= 303 - 3 && y >= 0 && y <= 7) { Config.getInstance().setMpMenuEnabled(false); CreeperHost.instance.saveConfig(); this.mc.displayGuiScreen(new GuiMultiplayer(null)); return true; } Minecraft.getMinecraft().displayGuiScreen(GuiGetServer.getByStep(0, new Order())); return true; }
@Override protected void actionPerformed(GuiButton button) throws IOException { if (button == this.buttonPrev) { this.mc.displayGuiScreen(getByStep(this.stepId - 1, this.order)); } else if (button == this.buttonNext) { if ((this.stepId + 1) == STEP_AMOUNT) { this.mc.displayGuiScreen(new GuiMultiplayer(null)); } else { this.mc.displayGuiScreen(getByStep(this.stepId + 1, this.order)); } } else if (button == this.buttonCancel) { this.mc.displayGuiScreen(null); } else { super.actionPerformed(button); } }
public static void joinLastServer(GuiMultiplayer guiMultiplayer) { if(lastServer == null) return; currentServerIP = lastServer.getServerData().serverIP; if(!currentServerIP.contains(":")) currentServerIP += ":25565"; guiMultiplayer.connectToServer(lastServer.getServerData()); }
public static void updateLastServerFromDirectConnect( GuiMultiplayer guiMultiplayer, ServerData serverData) { currentServerIP = serverData.serverIP; if(!currentServerIP.contains(":")) currentServerIP += ":25565"; lastServer = new ServerListEntryNormal(guiMultiplayer, serverData); }
@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()); } }
@CoreEvent public void action(final ActionPerformedEvent.Post e) { this.targetServerStatus = null; final GuiScreen screen = this.mc.currentScreen; final int id = this.compat.getButton(e).id; if (screen instanceof GuiMultiplayer&&id==BUTTON_ID) { final GuiMultiplayer mpgui = (GuiMultiplayer) screen; final ServerData server = getServerData(mpgui, this.compat.getSelected(mpgui)); if (server!=null) { if (!StringUtils.equals(this.target.getIP(), server.serverIP)) { this.autologin.set(false); this.target.set(server); } else if (!this.autologin.is()) { this.autologin.set(true); this.target.set(server); } else { this.autologin.set(false); this.target.set(null); } } else selectTarget(mpgui, this.target.getIP()); } else if (screen instanceof GuiDisconnected&&id==DISABLE_BACK_BUTTON_ID) { final GuiDisconnected dcgui = (GuiDisconnected) screen; this.autologin.set(false); this.target.set(null); this.mc.displayGuiScreen(this.compat.getParentScreen(dcgui)); } this.displayTime = ""; reset(Config.getConfig().durationPing); this.manual = false; }
public ServerData get(final GuiMultiplayer mpgui) { final String targetServerIP = Config.getConfig().targetServerIP.get(); if (mpgui!=this.mpgui_cache||!StringUtils.equals(this.targetIP_cache, targetServerIP)) { this.target = getServerData(mpgui, getTarget(mpgui, this.targetIP_cache = targetServerIP)); this.mpgui_cache = mpgui; } return this.target; }
private int getTarget(final GuiMultiplayer mpgui, final String serverIP) { final int count = this.compat.countServers(mpgui); for (int i = 0; i<count; i++) { final ServerData serverData = this.compat.getServerData(mpgui, i); if (StringUtils.equals(serverIP, serverData.serverIP)) return i; } return -1; }
private ServerData getServerData(final GuiMultiplayer mpgui, final int index) { if (index<0) return null; final IGuiListEntry guilistextended$iguilistentry = this.compat.getListEntry(mpgui, index); if (guilistextended$iguilistentry instanceof ServerListEntryNormal) return this.compat.getServerData((ServerListEntryNormal) guilistextended$iguilistentry); return null; }
public EventGuiScreenDisplay(GuiScreen screen) { this.screen = screen; if (screen instanceof GuiMainMenu) { type = ScreenTypes.MainMenu; } else if (screen instanceof GuiMultiplayer) { type = ScreenTypes.Multiplayer; } else { type = ScreenTypes.Unknown; } }
public static void exportServers(GuiMultiplayer guiMultiplayer) { JFileChooser fileChooser = new JFileChooser(WurstFolders.SERVERLISTS.toFile()) { @Override protected JDialog createDialog(Component parent) throws HeadlessException { JDialog dialog = super.createDialog(parent); dialog.setAlwaysOnTop(true); return dialog; } }; fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter( new FileNameExtensionFilter("TXT files", "txt")); int action = fileChooser.showSaveDialog(FrameHook.getFrame()); if(action == JFileChooser.APPROVE_OPTION) try { File file = fileChooser.getSelectedFile(); if(!file.getName().endsWith(".txt")) file = new File(file.getPath() + ".txt"); PrintWriter save = new PrintWriter(new FileWriter(file)); for(int i = 0; i < guiMultiplayer.savedServerList .countServers(); i++) save.println(guiMultiplayer.savedServerList .getServerData(i).serverIP); save.close(); }catch(IOException e) { e.printStackTrace(); MiscUtils.simpleError(e, fileChooser); } }