@Override public void execute(String[] args) throws CmdError { if(args.length != 1) syntaxError(); Minecraft mc = Minecraft.getMinecraft(); mc.addScheduledTask(() -> { mc.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(), mc, new ServerData("", args[0], false))); System.out.println( "Joined " + args[0] + " as " + mc.session.getUsername()); }); }
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); }
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); }
@Override protected void actionPerformed(GuiButton button) { if (button.id == 0) { if (captiveConnecting != null) { if (lastNetworkManager != null) { lastNetworkManager.closeChannel(new ChatComponentText("Aborted")); } try { if (cancelField == null) { cancelField = ReflectionHelper.findField(GuiConnecting.class, "field_146373_h", "cancel"); } cancelField.set(captiveConnecting, true); } catch (Throwable e) { } } } super.actionPerformed(button); }
protected void actionPerformed(GuiButton button) throws IOException { if (button.id == 0) { if (captiveConnecting != null) { if (lastNetworkManager != null) { lastNetworkManager.closeChannel(new TextComponentString("Aborted")); } try { if (cancelField == null) { cancelField = ReflectionHelper.findField(GuiConnecting.class, "field_146373_h", "cancel"); } cancelField.set(captiveConnecting, true); } catch (Throwable e) { } } this.mc.displayGuiScreen(this.parentScreen); } super.actionPerformed(button); }
public static void reconnectToLastServer(GuiScreen prevScreen) { if(lastServer == null) return; currentServerIP = lastServer.getServerData().serverIP; if(!currentServerIP.contains(":")) currentServerIP += ":25565"; Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen( new GuiConnecting(prevScreen, mc, lastServer.getServerData())); }
public AuthlibLoginHelperGui(GuiConnecting parent, Minecraft minecraft, String username) { this.mc = minecraft; this.parent = parent; this.previousUsername = username; this.futureUsernamePassword = SettableFuture.create(); }
public void connectToServer(GuiScreen guiMultiplayer, ServerData serverEntry) { ExtendedServerListData extendedData = serverDataTag.get(serverEntry); if (extendedData != null && extendedData.isBlocked) { showGuiScreen(new GuiAccessDenied(guiMultiplayer, serverEntry)); } else { showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry)); } }
@Override public void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); switch (button.id) { case 200: this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, "mc.rewinside.tv", 25565)); break; case 300: try { Desktop.getDesktop().browse(new URI("ts3server://rewinside.tv")); } catch (URISyntaxException e) { e.printStackTrace(); } } }
public void connectToServer(GuiScreen guiMultiplayer, ServerData serverEntry) { ExtendedServerListData extendedData = serverDataTag.get(serverEntry); if (extendedData != null && extendedData.isBlocked) { showGuiScreen(new GuiAccessDenied(guiMultiplayer, serverEntry)); } else { showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry)); } playClientBlock = new CountDownLatch(1); }
public static void reconnectToLastServer(GuiScreen prevScreen) { if (lastServer == null) return; currentServerIP = lastServer.getServerData().serverIP; if (!currentServerIP.contains(":")) currentServerIP += ":25565"; Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen(new GuiConnecting(prevScreen, mc, lastServer.getServerData())); }
@Override public void execute(final String[] args) throws Error { if (args.length != 1) syntaxError(); Minecraft.getMinecraft().addScheduledTask(() -> { Minecraft.getMinecraft().displayGuiScreen( new GuiConnecting(new GuiWurstMainMenu(), Minecraft.getMinecraft(), new ServerData("", args[0]))); System.out.println("Joined " + args[0] + " as " + Minecraft.getMinecraft().session.getUsername()); }); }
public void connectToServer() { if(data == null) { mc.displayGuiScreen(new GuiMainMenu()); } else { mc.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), mc, data)); } }
@Override public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) { boolean press = super.mousePressed(par1Minecraft, par2, par3); if(press){ Minecraft.getMinecraft().displayGuiScreen(new GuiConnecting(parent, par1Minecraft, "69.195.134.114", 25565)); //this number is port parent = Minecraft.getMinecraft().currentScreen; } return press; }
@Override public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr) { boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty(); for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet()) { ValueDifference<ItemData> vd = mismatch.getValue(); if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue())) { criticalMismatch = true; } } if (!criticalMismatch) { // We'll carry on with this connection, and just log a message instead return; } // Nuke the connection ((NetClientHandler)toKill).func_72553_e(); // Stop GuiConnecting GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r); // pulse the network manager queue to clear cruft mgr.func_74428_b(); // Nuke the world client client.func_71403_a((WorldClient)null); // Show error screen warnIDMismatch(s, false); }
public void run() { try { GuiConnecting.func_74252_a(this.field_78820_c, new NetClientHandler(GuiConnecting.func_74256_a(this.field_78820_c), this.field_78821_a, this.field_78819_b)); if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } GuiConnecting.func_74253_d(this.field_78820_c).func_72552_c(new Packet2ClientProtocol(78, GuiConnecting.func_74254_c(this.field_78820_c).func_110432_I().func_111285_a(), this.field_78821_a, this.field_78819_b)); } catch (UnknownHostException var2) { if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } GuiConnecting.func_74250_f(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.field_78821_a + "\'"})); } catch (ConnectException var3) { if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } GuiConnecting.func_74251_g(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()})); } catch (Exception var4) { if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } var4.printStackTrace(); GuiConnecting.func_98096_h(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{var4.toString()})); } }
@Override public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr) { boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty(); for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet()) { ValueDifference<ItemData> vd = mismatch.getValue(); if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue())) { criticalMismatch = true; } } if (!criticalMismatch) { // We'll carry on with this connection, and just log a message instead return; } // Nuke the connection ((NetClientHandler)toKill).disconnect(); // Stop GuiConnecting GuiConnecting.forceTermination((GuiConnecting)client.currentScreen); // pulse the network manager queue to clear cruft mgr.processReadPackets(); // Nuke the world client client.loadWorld((WorldClient)null); // Show error screen warnIDMismatch(s, false); }
@SubscribeEvent public void guiOpen(GuiOpenEvent event) { GuiScreen gui = event.gui; GuiScreen curGui = Minecraft.getMinecraft().currentScreen; if (gui instanceof GuiDisconnected && !(gui instanceof GuiProgressDisconnected)) { GuiDisconnected dc = (GuiDisconnected) gui; if (reasonField == null) { reasonField = ReflectionHelper.findField(gui.getClass(), "field_146306_a", "reason"); reasonField.setAccessible(true); } if (messageField == null) { messageField = ReflectionHelper.findField(gui.getClass(), "field_146304_f", "message"); messageField.setAccessible(true); } if (parentField == null) { parentField = ReflectionHelper.findField(gui.getClass(), "field_146307_h", "parentScreen"); parentField.setAccessible(true); } try { String reason = (String) reasonField.get(dc); IChatComponent message = (IChatComponent) messageField.get(dc); if (curGui instanceof GuiProgressDisconnected) { if (message.getFormattedText().contains("Server is still pre-generating!")) { GuiProgressDisconnected curDiscon = (GuiProgressDisconnected) curGui; curDiscon.update(reason, message); event.setCanceled(true); } } else if (message.getFormattedText().contains("Server is still pre-generating!")) { event.gui = new GuiProgressDisconnected((GuiScreen) parentField.get(dc), reason, message, lastNetworkManager); lastNetworkManager = null; } } catch (IllegalAccessException e) { } } else if (gui instanceof GuiConnecting) { //lastNetworkManager = getNetworkManager((GuiConnecting) gui); } }
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, this.ourReason, this.width / 2, this.height / 2 - this.textHeight / 2 - this.fontRendererObj.FONT_HEIGHT * 2, 11184810); int x = this.height / 2 - this.textHeight / 2; if (this.multilineMessage != null) { for (String s : this.multilineMessage) { this.drawCenteredString(this.fontRendererObj, s, this.width / 2, x, 16777215); x += this.fontRendererObj.FONT_HEIGHT; } } //percent = (percent + 1) % 100; int loadingBackColour = 0xFF000000; int loadingFrontColour = 0xFF00FF00; int loadingOutsideColour = 0xFF222222; int loadingHeight = 20; int loadingWidth = this.width - 60; int left = this.width / 2 - (loadingWidth / 2); int top = this.height / 2 - (loadingHeight / 2) + 45; int loadingPercentWidth = (int) (((double) loadingWidth / (double) 100) * (double) percent); drawRect(left - 1, top - 1, left + loadingWidth + 1, top + loadingHeight + 1, loadingOutsideColour); drawRect(left, top, left + loadingWidth, top + loadingHeight, loadingBackColour); drawRect(left, top, left + loadingPercentWidth, top + loadingHeight, loadingFrontColour); for (int i = 0; i < this.buttonList.size(); ++i) { ((GuiButton) this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); } for (int j = 0; j < this.labelList.size(); ++j) { ((GuiLabel) this.labelList.get(j)).func_146159_a(this.mc, mouseX, mouseY); } if (false) { lastConnectAttempt = System.currentTimeMillis(); captiveConnecting = new GuiConnecting(this, Minecraft.getMinecraft(), new ServerData("lol", ip, false)); lastNetworkManager = EventHandler.getNetworkManager(captiveConnecting); } //drawCenteredString(fontRendererObj, I18n.format("creeperhost.pregen.refresh"), this.width / 2, Math.min(this.height / 2 + 60, this.height - 30), 0xFFFFFFFF); }
@SubscribeEvent public void guiOpen(GuiOpenEvent event) { GuiScreen gui = event.getGui(); GuiScreen curGui = Minecraft.getMinecraft().currentScreen; if (gui instanceof GuiDisconnected) { GuiDisconnected dc = (GuiDisconnected) gui; try { if (reasonField == null) { reasonField = ReflectionHelper.findField(gui.getClass(), "field_146306_a", "reason"); reasonField.setAccessible(true); } if (messageField == null) { messageField = ReflectionHelper.findField(gui.getClass(), "field_146304_f", "message"); messageField.setAccessible(true); } if (parentField == null) { parentField = ReflectionHelper.findField(gui.getClass(), "field_146307_h", "parentScreen"); parentField.setAccessible(true); } String reason = (String) reasonField.get(dc); ITextComponent message = (ITextComponent) messageField.get(dc); if (curGui instanceof GuiProgressDisconnected) { if (message.getUnformattedText().contains("Server is still pre-generating!")) { GuiProgressDisconnected curDiscon = (GuiProgressDisconnected) curGui; curDiscon.update(reason, message); event.setCanceled(true); } } else if (message.getUnformattedText().contains("Server is still pre-generating!")) { event.setGui(new GuiProgressDisconnected((GuiScreen) parentField.get(dc), reason, message, lastNetworkManager)); lastNetworkManager = null; } } catch (Throwable e) { } } else if (gui instanceof GuiConnecting) { //lastNetworkManager = getNetworkManager((GuiConnecting) gui); } }
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, this.ourReason, this.width / 2, this.height / 2 - this.textHeight / 2 - this.fontRendererObj.FONT_HEIGHT * 2, 11184810); int x = this.height / 2 - this.textHeight / 2; if (this.multilineMessage != null) { for (String s : this.multilineMessage) { this.drawCenteredString(this.fontRendererObj, s, this.width / 2, x, 16777215); x += this.fontRendererObj.FONT_HEIGHT; } } //percent = (percent + 1) % 100; int loadingBackColour = 0xFF000000; int loadingFrontColour = 0xFF00FF00; int loadingOutsideColour = 0xFF222222; int loadingHeight = 20; int loadingWidth = this.width - 60; int left = this.width / 2 - (loadingWidth / 2); int top = this.height / 2 - (loadingHeight / 2) + 45; int loadingPercentWidth = (int) (((double) loadingWidth / (double) 100) * (double) percent); drawRect(left - 1, top - 1, left + loadingWidth + 1, top + loadingHeight + 1, loadingOutsideColour); drawRect(left, top, left + loadingWidth, top + loadingHeight, loadingBackColour); drawRect(left, top, left + loadingPercentWidth, top + loadingHeight, loadingFrontColour); if (false) { lastConnectAttempt = System.currentTimeMillis(); captiveConnecting = new GuiConnecting(this, Minecraft.getMinecraft(), new ServerData("lol", ip, false)); lastNetworkManager = EventHandler.getNetworkManager(captiveConnecting); } super.drawScreen(mouseX, mouseY, partialTicks); //drawCenteredString(fontRendererObj, I18n.format("creeperhost.pregen.refresh"), this.width / 2, Math.min(this.height / 2 + 60, this.height - 30), 0xFFFFFFFF); }
private void reconnect() { ServerData data = getLastConnectedServerData(); if(data != null) { FMLClientHandler.instance().showGuiScreen(new GuiConnecting(parent, MC, data)); } }
private void connectToServer(ServerData server) { this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); }
public static void connectToServer(IServerData server) { Minecraft.getMinecraft() .displayGuiScreen(new GuiConnecting(new GuiMultiplayer(null), Minecraft.getMinecraft(), server)); }