Java 类net.minecraft.client.gui.GuiDisconnected 实例源码

项目:ForgeHax    文件:AutoReconnectMod.java   
@SubscribeEvent
public void onGuiOpened(GuiOpenEvent event) {
    if (!hasAutoLogged)
    if(event.getGui() instanceof GuiDisconnected &&
            !(event.getGui() instanceof GuiDisconnectedOverride)) {
        updateLastConnectedServer();
        GuiDisconnected disconnected = (GuiDisconnected)event.getGui();
        event.setGui(new GuiDisconnectedOverride(
                FastReflection.Fields.GuiDisconnected_parentScreen.get(disconnected),
                "connect.failed",
                FastReflection.Fields.GuiDisconnected_message.get(disconnected),
                FastReflection.Fields.GuiDisconnected_reason.get(disconnected),
                delay.get()
        ));
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:EMC    文件:EventGuiScreenDraw.java   
public boolean instanceOf(CommonScreenTypes type) {
    if (type.equals(CommonScreenTypes.GuiDisconnected)) {
        return screen instanceof GuiDisconnected;
    } else if (type.equals(CommonScreenTypes.GuiIngameMenu)) {
        return screen instanceof GuiIngameMenu;
    }
    return false;
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:BeProductive    文件:BeProductive.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClientTick(TickEvent.ClientTickEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    if (event.phase == TickEvent.Phase.END && mc.theWorld != null && !mc.isSingleplayer()) {
        UUID uuid = mc.thePlayer.getUniqueID();
        timeOnCount.add(uuid);

        if ((maxTimeOn.containsKey(uuid) && timeOnCount.count(uuid) > maxTimeOn.get(uuid)) || (maxTimeOnGlobal != 0 && timeOnCount.count(uuid) > maxTimeOnGlobal)) {
            rejoinTime.put(uuid, System.currentTimeMillis() + (breakTime.containsKey(uuid) ? breakTime.get(uuid) * 50 : breakTimeGlobal * 50));
            timeOnCount.remove(uuid, timeOnCount.count(uuid));
        }

        //Disconnect if still on timeout
        if (rejoinTime.containsKey(uuid) && System.currentTimeMillis() < rejoinTime.get(uuid)) {
            mc.theWorld.sendQuittingDisconnectingPacket();
            mc.loadWorld(null);
            mc.displayGuiScreen(new GuiDisconnected(null, String.format(kickMessage + " You can rejoin in approx. %s minute(s)",
                    (int) Math.floor(((rejoinTime.get(uuid) - System.currentTimeMillis()) / 1000F) / 60F)), new TextComponentString("")));
        }
    }
}
项目:AutoJoin    文件:AutoJoin.java   
@SubscribeEvent
public void onTick(ClientTickEvent event) {
    if(mc.currentScreen instanceof GuiDisconnected) {
        GuiDisconnected current = (GuiDisconnected) mc.currentScreen;
        current.drawCenteredString(mc.fontRendererObj, time + " seconds", current.width / 2, 30, Color.WHITE.getRGB());
        if(System.currentTimeMillis() - last >= 1000l) {
            time--;
            last = System.currentTimeMillis();
        }
        if(time == 0) {
            connectToServer();
        }
    }
    if(mc.getCurrentServerData() != null) {
        data = mc.getCurrentServerData();
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * 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));
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
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_));
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
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_));
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
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));
        }
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
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));
        }
    }
}
项目:ForgeHax    文件:AutoReconnectMod.java   
public GuiDisconnectedOverride(GuiScreen screen, String reasonLocalizationKey, ITextComponent chatComp, String reason, double delay) {
    super(screen, reasonLocalizationKey, chatComp);
    parent = screen;
    message = chatComp;
    reconnectTime = System.currentTimeMillis() + (long)(delay * 1000);
    // set variable 'reason' to the previous classes value
    try {
        ReflectionHelper.setPrivateValue(GuiDisconnected.class, this, reason, "reason", "field_146306_a", "a"); // TODO: Find obbed mapping name
    } catch (Exception e) {
        Helper.printStackTrace(e);
    }
    // parse server return text and find queue pos
}
项目:ServerObserver    文件:GuiHandler.java   
@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());
    }
}
项目:ServerObserver    文件:GuiHandler.java   
@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;
}
项目:Backmemed    文件:NetHandlerLoginClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(ITextComponent reason)
{
    if (this.previousGuiScreen != null && this.previousGuiScreen instanceof GuiScreenRealmsProxy)
    {
        this.mc.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.previousGuiScreen).getProxy(), "connect.failed", reason)).getProxy());
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
    }
}
项目:CustomWorldGen    文件:NetHandlerLoginClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(ITextComponent reason)
{
    if (this.previousGuiScreen != null && this.previousGuiScreen instanceof GuiScreenRealmsProxy)
    {
        this.mc.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.previousGuiScreen).getProxy(), "connect.failed", reason)).getProxy());
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
    }
}
项目:AutoJoin    文件:AutoJoin.java   
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
    if(event.getGui() instanceof GuiDisconnected) {
        last = System.currentTimeMillis();
        time = 10;
    }
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(IChatComponent p_147231_1_)
{
    this.gameController.loadWorld((WorldClient)null);

    if (this.guiScreenServer != null)
    {
        this.gameController.displayGuiScreen(new GuiScreenDisconnectedOnline(this.guiScreenServer, "disconnect.lost", p_147231_1_));
    }
    else
    {
        this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new HookGuiMainMenu()), "disconnect.lost", p_147231_1_));
    }
}
项目:ExpandedRailsMod    文件:NetHandlerLoginClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(ITextComponent reason)
{
    if (this.previousGuiScreen != null && this.previousGuiScreen instanceof GuiScreenRealmsProxy)
    {
        this.mc.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.previousGuiScreen).getProxy(), "connect.failed", reason)).getProxy());
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72492_a(Packet255KickDisconnect p_72492_1_) {
   this.field_72555_g.func_74424_a("disconnect.kicked", new Object[0]);
   this.field_72554_f = true;
   this.field_72563_h.func_71403_a((WorldClient)null);
   if(this.field_98183_l != null) {
      this.field_72563_h.func_71373_a(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.disconnected", "disconnect.genericReason", new Object[]{p_72492_1_.field_73631_a}));
   } else {
      this.field_72563_h.func_71373_a(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "disconnect.genericReason", new Object[]{p_72492_1_.field_73631_a}));
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72515_a(String p_72515_1_, Object[] p_72515_2_) {
   if(!this.field_72554_f) {
      this.field_72554_f = true;
      this.field_72563_h.func_71403_a((WorldClient)null);
      if(this.field_98183_l != null) {
         this.field_72563_h.func_71373_a(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.lost", p_72515_1_, p_72515_2_));
      } else {
         this.field_72563_h.func_71373_a(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", p_72515_1_, p_72515_2_));
      }

   }
}
项目:RuneCraftery    文件:ThreadConnectToServer.java   
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()}));
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{
    this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason);
    this.disconnected = true;
    this.mc.loadWorld((WorldClient)null);

    if (this.field_98183_l != null)
    {
        this.mc.displayGuiScreen(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{
    this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason);
    this.disconnected = true;
    this.mc.loadWorld((WorldClient)null);

    if (this.field_98183_l != null)
    {
        this.mc.displayGuiScreen(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
    }
}
项目:DecompiledMinecraft    文件:NetHandlerLoginClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(IChatComponent reason)
{
    this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
}
项目:DecompiledMinecraft    文件:GuiConnecting.java   
private void connect(final String ip, final int port)
{
    logger.info("Connecting to " + ip + ", " + port);
    (new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet())
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                inetaddress = InetAddress.getByName(ip);
                GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f());
                GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
                GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN));
                GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)unknownhostexception);
                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"})));
            }
            catch (Exception exception)
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)exception);
                String s = exception.toString();

                if (inetaddress != null)
                {
                    String s1 = inetaddress.toString() + ":" + port;
                    s = s.replaceAll(s1, "");
                }

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:BaseClient    文件:NetHandlerLoginClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(IChatComponent reason)
{
    this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
}
项目:BaseClient    文件:GuiConnecting.java   
private void connect(final String ip, final int port)
{
    logger.info("Connecting to " + ip + ", " + port);
    (new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet())
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                inetaddress = InetAddress.getByName(ip);
                GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f());
                GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
                GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN));
                GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)unknownhostexception);
                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"})));
            }
            catch (Exception exception)
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)exception);
                String s = exception.toString();

                if (inetaddress != null)
                {
                    String s1 = inetaddress.toString() + ":" + port;
                    s = s.replaceAll(s1, "");
                }

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:BaseClient    文件:NetHandlerLoginClient.java   
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(IChatComponent reason)
{
    this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
}
项目:BaseClient    文件:GuiConnecting.java   
private void connect(final String ip, final int port)
{
    logger.info("Connecting to " + ip + ", " + port);
    (new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet())
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                inetaddress = InetAddress.getByName(ip);
                GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f());
                GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
                GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN));
                GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)unknownhostexception);
                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"})));
            }
            catch (Exception exception)
            {
                if (GuiConnecting.this.cancel)
                {
                    return;
                }

                GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)exception);
                String s = exception.toString();

                if (inetaddress != null)
                {
                    String s1 = inetaddress.toString() + ":" + port;
                    s = s.replaceAll(s1, "");
                }

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:Proyecto-DASI    文件:ClientStateMachine.java   
@Override
protected void onClientTick(ClientTickEvent ev)
{
    // Check to see whether anything has caused us to abort - if so, go to the abort state.
    if (inAbortState())
        episodeHasCompleted(ClientState.MISSION_ABORTED);

    if (ticksUntilNextPing == 0)
    {
        // Tell the server what our agent name is.
        // We do this repeatedly, because the server might not yet be listening.
        if (Minecraft.getMinecraft().thePlayer != null && !this.waitingForChunk)
        {
            HashMap<String, String> map = new HashMap<String, String>();
            map.put("agentname", agentName);
            map.put("username", Minecraft.getMinecraft().thePlayer.getName());
            currentMissionBehaviour().appendExtraServerInformation(map);
            System.out.println("***Telling server we are ready - " + agentName);
            MalmoMod.network.sendToServer(new MalmoMod.MalmoMessage(MalmoMessageType.CLIENT_AGENTREADY, 0, map));
        }

        // We also ping our agent, just to check it is still available:
        pingAgent(true);    // Will abort to an error state if client unavailable.

        ticksUntilNextPing = 10; // Try again in ten ticks.
    }
    else
    {
        ticksUntilNextPing--;
    }

    if (this.waitingForChunk)
    {
        // The server is ready, we're just waiting for our chunk to appear.
        if (isChunkReady())
            proceed();
    }

    List<AgentSection> agents = currentMissionInit().getMission().getAgentSection();
    if (agents.size() > 1 && currentMissionInit().getClientRole() != 0)
    {
        // We are waiting to join an out-of-process server. Need to pay attention to what happens -
        // if we can't join, for any reason, we should abort the mission.
        GuiScreen screen = Minecraft.getMinecraft().currentScreen;
        if (screen != null && screen instanceof GuiDisconnected)
        {
            // Disconnected screen appears when something has gone wrong.
            // Would be nice to grab the reason from the screen, but it's a private member.
            // (Can always use reflection, but it's so inelegant.)
            episodeHasCompletedWithErrors(ClientState.ERROR_CANNOT_CONNECT_TO_SERVER, "Unable to connect to Minecraft server in multi-agent mission.");
        }
    }
}
项目:Proyecto-DASI    文件:ClientStateMachine.java   
@Override
protected void onClientTick(ClientTickEvent ev)
{
    // Check to see whether anything has caused us to abort - if so, go to the abort state.
    if (inAbortState())
        episodeHasCompleted(ClientState.MISSION_ABORTED);

    if (ticksUntilNextPing == 0)
    {
        // Tell the server what our agent name is.
        // We do this repeatedly, because the server might not yet be listening.
        if (Minecraft.getMinecraft().thePlayer != null && !this.waitingForChunk)
        {
            HashMap<String, String> map = new HashMap<String, String>();
            map.put("agentname", agentName);
            map.put("username", Minecraft.getMinecraft().thePlayer.getName());
            currentMissionBehaviour().appendExtraServerInformation(map);
            System.out.println("***Telling server we are ready - " + agentName);
            MalmoMod.network.sendToServer(new MalmoMod.MalmoMessage(MalmoMessageType.CLIENT_AGENTREADY, 0, map));
        }

        // We also ping our agent, just to check it is still available:
        pingAgent(true);    // Will abort to an error state if client unavailable.

        ticksUntilNextPing = 10; // Try again in ten ticks.
    }
    else
    {
        ticksUntilNextPing--;
    }

    if (this.waitingForChunk)
    {
        // The server is ready, we're just waiting for our chunk to appear.
        if (isChunkReady())
            proceed();
    }

    List<AgentSection> agents = currentMissionInit().getMission().getAgentSection();
    if (agents.size() > 1 && currentMissionInit().getClientRole() != 0)
    {
        // We are waiting to join an out-of-process server. Need to pay attention to what happens -
        // if we can't join, for any reason, we should abort the mission.
        GuiScreen screen = Minecraft.getMinecraft().currentScreen;
        if (screen != null && screen instanceof GuiDisconnected)
        {
            // Disconnected screen appears when something has gone wrong.
            // Would be nice to grab the reason from the screen, but it's a private member.
            // (Can always use reflection, but it's so inelegant.)
            episodeHasCompletedWithErrors(ClientState.ERROR_CANNOT_CONNECT_TO_SERVER, "Unable to connect to Minecraft server in multi-agent mission.");
        }
    }
}
项目:ServerObserver    文件:Compat.java   
@Override
public int getHeight(final GuiDisconnected dcgui) {
    return dcgui.height/2+dcgui.textHeight/2+font(dcgui.mc).FONT_HEIGHT+25;
}
项目:ServerObserver    文件:Compat.java   
@Override
public GuiScreen getParentScreen(final GuiDisconnected dcgui) {
    return dcgui.parentScreen;
}
项目:ServerObserver    文件:Compat.java   
@Override
public int getHeight(final GuiDisconnected dcgui) {
    return dcgui.height/2+dcgui.textHeight/2+font(dcgui.mc).FONT_HEIGHT+25;
}
项目:ServerObserver    文件:Compat.java   
@Override
public GuiScreen getParentScreen(final GuiDisconnected dcgui) {
    return dcgui.parentScreen;
}