Java 类net.minecraft.network.handshake.client.C00Handshake 实例源码

项目:NeptuneMod    文件:MixinNetHandlerHandshakeTCP_Bungee.java   
@Inject(method = "processHandshake", at = @At(value = "HEAD"), cancellable = true)
private void onProcessHandshake(C00Handshake packetIn, CallbackInfo ci) {
    if (packetIn.getRequestedState().equals(EnumConnectionState.LOGIN)) {
        final String[] split = packetIn.ip.split("\00");

        if (split.length >= 3) {
            packetIn.ip = split[0];
            ((IMixinNetworkManager_Bungee) this.networkManager).setRemoteAddress(new InetSocketAddress(split[1],
                            ((InetSocketAddress) this.networkManager.getRemoteAddress()).getPort()));
            ((IMixinNetworkManager_Bungee) this.networkManager).setSpoofedUUID(UUIDTypeAdapter.fromString(split[2]));

            if (split.length == 4) {
                ((IMixinNetworkManager_Bungee) this.networkManager).setSpoofedProfile(GSON.fromJson(split[3], Property[].class));
            }
        } else {
            final ChatComponentText chatcomponenttext =
                    new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
            this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
            this.networkManager.closeChannel(chatcomponenttext);
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 47)
            {
                ChatComponentText chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
                this.networkManager.closeChannel(chatcomponenttext);
            }
            else if (packetIn.getProtocolVersion() < 47)
            {
                ChatComponentText chatcomponenttext1 = new ChatComponentText("Outdated client! Please use 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext1));
                this.networkManager.closeChannel(chatcomponenttext1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;

        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:DecompiledMinecraft    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 47)
            {
                ChatComponentText chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
                this.networkManager.closeChannel(chatcomponenttext);
            }
            else if (packetIn.getProtocolVersion() < 47)
            {
                ChatComponentText chatcomponenttext1 = new ChatComponentText("Outdated client! Please use 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext1));
                this.networkManager.closeChannel(chatcomponenttext1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;

        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:BaseClient    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 47)
            {
                ChatComponentText chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
                this.networkManager.closeChannel(chatcomponenttext);
            }
            else if (packetIn.getProtocolVersion() < 47)
            {
                ChatComponentText chatcomponenttext1 = new ChatComponentText("Outdated client! Please use 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext1));
                this.networkManager.closeChannel(chatcomponenttext1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;

        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:BaseClient    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 47)
            {
                ChatComponentText chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
                this.networkManager.closeChannel(chatcomponenttext);
            }
            else if (packetIn.getProtocolVersion() < 47)
            {
                ChatComponentText chatcomponenttext1 = new ChatComponentText("Outdated client! Please use 1.8.8");
                this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext1));
                this.networkManager.closeChannel(chatcomponenttext1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;

        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:EMC    文件:OAuth.java   
public static void oAuth(OAuthCallback callback) {
    new Thread(() -> {
        try {
            InetAddress inetaddress = InetAddress.getByName(ip);
            OAuthNetworkManager manager = OAuthNetworkManager.createNetworkManagerAndConnect(inetaddress, port,
                    Minecraft.getMinecraft().gameSettings.isUsingNativeTransport(), callback);
            manager.setNetHandler(new OAuthNetHandler(manager, Minecraft.getMinecraft(), null, callback));
            manager.sendPacket(new C00Handshake(ip, port, EnumConnectionState.LOGIN));
            manager.sendPacket(new CPacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
        } catch (Exception ex) {
            callback.callback(false, "", "");
        }
    }).start();
}
项目:Backmemed    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 316)
            {
                TextComponentString textcomponentstring = new TextComponentString("Outdated server! I\'m still on 1.11.2");
                this.networkManager.sendPacket(new SPacketDisconnect(textcomponentstring));
                this.networkManager.closeChannel(textcomponentstring);
            }
            else if (packetIn.getProtocolVersion() < 316)
            {
                TextComponentString textcomponentstring1 = new TextComponentString("Outdated client! Please use 1.11.2");
                this.networkManager.sendPacket(new SPacketDisconnect(textcomponentstring1));
                this.networkManager.closeChannel(textcomponentstring1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;

        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:CustomWorldGen    文件:NetHandlerHandshakeMemory.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}
项目:CustomWorldGen    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;

    switch (packetIn.getRequestedState())
    {
        case LOGIN:
            this.networkManager.setConnectionState(EnumConnectionState.LOGIN);

            if (packetIn.getProtocolVersion() > 210)
            {
                TextComponentString textcomponentstring = new TextComponentString("Outdated server! I\'m still on 1.10.2");
                this.networkManager.sendPacket(new SPacketDisconnect(textcomponentstring));
                this.networkManager.closeChannel(textcomponentstring);
            }
            else if (packetIn.getProtocolVersion() < 210)
            {
                TextComponentString textcomponentstring1 = new TextComponentString("Outdated client! Please use 1.10.2");
                this.networkManager.sendPacket(new SPacketDisconnect(textcomponentstring1));
                this.networkManager.closeChannel(textcomponentstring1);
            }
            else
            {
                this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
            }

            break;
        case STATUS:
            this.networkManager.setConnectionState(EnumConnectionState.STATUS);
            this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager));
            break;
        default:
            throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState());
    }
}
项目:wizards-of-lua    文件:ReconnectAction.java   
private void connect(String ip, int port) throws UnknownHostException {
  InetAddress inetaddress = InetAddress.getByName(ip);
  Minecraft minecraft = Minecraft.getMinecraft();
  boolean isUsingNativeTransport = minecraft.gameSettings.isUsingNativeTransport();
  GuiScreen previousGuiScreen = null;
  // The following code is copied from
  // net.minecraft.client.multiplayer.GuiConnecting.connect(String, int)
  NetworkManager networkManager =
      NetworkManager.createNetworkManagerAndConnect(inetaddress, port, isUsingNativeTransport);
  networkManager
      .setNetHandler(new NetHandlerLoginClient(networkManager, minecraft, previousGuiScreen));
  networkManager.sendPacket(new C00Handshake(316, ip, port, EnumConnectionState.LOGIN, true));
  networkManager.sendPacket(new CPacketLoginStart(minecraft.getSession().getProfile()));
}
项目:NeptuneCommon    文件:MixinNetHandlerHandshakeTCP.java   
@Inject(method = "processHandshake", at = @At("HEAD"))
public void onProcessHandshake(C00Handshake packetIn, CallbackInfo ci) {
    IMixinNetworkManager info = (IMixinNetworkManager) this.networkManager;
    info.setProtocolVersion(packetIn.getProtocolVersion());
    info.setHostnamePinged(packetIn.ip);
    info.setPortPinged(packetIn.port);
}
项目:Resilience-Client-Source    文件:NetHandlerHandshakeTCP.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake p_147383_1_)
{
    switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.field_151291_a[p_147383_1_.func_149594_c().ordinal()])
    {
        case 1:
            this.field_147386_b.setConnectionState(EnumConnectionState.LOGIN);
            ChatComponentText var2;

            if (p_147383_1_.func_149595_d() > 4)
            {
                var2 = new ChatComponentText("Outdated server! I\'m still on 1.7.2");
                this.field_147386_b.scheduleOutboundPacket(new S00PacketDisconnect(var2), new GenericFutureListener[0]);
                this.field_147386_b.closeChannel(var2);
            }
            else if (p_147383_1_.func_149595_d() < 4)
            {
                var2 = new ChatComponentText("Outdated client! Please use 1.7.2");
                this.field_147386_b.scheduleOutboundPacket(new S00PacketDisconnect(var2), new GenericFutureListener[0]);
                this.field_147386_b.closeChannel(var2);
            }
            else
            {
                this.field_147386_b.setNetHandler(new NetHandlerLoginServer(this.field_147387_a, this.field_147386_b));
            }

            break;

        case 2:
            this.field_147386_b.setConnectionState(EnumConnectionState.STATUS);
            this.field_147386_b.setNetHandler(new NetHandlerStatusServer(this.field_147387_a, this.field_147386_b));
            break;

        default:
            throw new UnsupportedOperationException("Invalid intention " + p_147383_1_.func_149594_c());
    }
}
项目:NeptuneMod    文件:MixinNetHandlerHandshakeTCP.java   
@Inject(method = "processHandshake", at = @At(value = "HEAD"))
private void onProcessHandshake(C00Handshake packetIn, CallbackInfo ci) {
    final IMixinNetworkManager info = (IMixinNetworkManager) this.networkManager;
    info.setProtocolVersion(packetIn.getProtocolVersion());
    info.setHostnamePinged(packetIn.ip);
    info.setPortPinged(packetIn.port);
}
项目:ExpandedRailsMod    文件:NetHandlerHandshakeMemory.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}
项目:nailed    文件:ServerStartingConnectionDestroyer.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, C00Handshake packet) throws Exception {
    if(!NettyChannelInitializer.serverStarting){
        ctx.fireChannelRead(packet);
        ctx.pipeline().remove(this);
    }else{
        ctx.writeAndFlush(new S00PacketDisconnect(new ChatComponentText("Server is still starting! Please wait before connecting!"))).addListener(ChannelFutureListener.CLOSE);
    }
}
项目:DecompiledMinecraft    文件:RealmsConnect.java   
public void connect(final String p_connect_1_, final int p_connect_2_)
{
    Realms.setConnectedToRealms(true);
    (new Thread("Realms-connect-task")
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                inetaddress = InetAddress.getByName(p_connect_1_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection = NetworkManager.func_181124_a(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.func_181148_f());

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00PacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
                Minecraft.getMinecraft().getResourcePackRepository().func_148529_f();
                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
            }
            catch (Exception exception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
                String s = exception.toString();

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

                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:DecompiledMinecraft    文件:NetHandlerHandshakeMemory.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}
项目: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    文件:RealmsConnect.java   
public void connect(final String p_connect_1_, final int p_connect_2_)
{
    Realms.setConnectedToRealms(true);
    (new Thread("Realms-connect-task")
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                inetaddress = InetAddress.getByName(p_connect_1_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection = NetworkManager.func_181124_a(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.func_181148_f());

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00PacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
                Minecraft.getMinecraft().getResourcePackRepository().func_148529_f();
                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
            }
            catch (Exception exception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
                String s = exception.toString();

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

                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:BaseClient    文件:NetHandlerHandshakeMemory.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}
项目: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    文件:RealmsConnect.java   
public void connect(final String p_connect_1_, final int p_connect_2_)
{
    Realms.setConnectedToRealms(true);
    (new Thread("Realms-connect-task")
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                inetaddress = InetAddress.getByName(p_connect_1_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection = NetworkManager.func_181124_a(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.func_181148_f());

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00PacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
                Minecraft.getMinecraft().getResourcePackRepository().func_148529_f();
                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
            }
            catch (Exception exception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
                String s = exception.toString();

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

                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:BaseClient    文件:NetHandlerHandshakeMemory.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}
项目: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();
}
项目:PacketControl    文件:PacketRegistryModule.java   
@DelayedRegistration(RegistrationPhase.PRE_INIT)
@Override
public void registerDefaults() {
    // Handshake
    register("handshake", "Handshake", PacketSide.SERVERBOUND, PacketPhase.HANDSHAKE, C00Handshake.class);

    // Entity
    clientbound("destroy_entities", "Destroy Entities", SPacketDestroyEntities.class, PacketControlFactory::createDestroyEntities);
    clientbound("entity_metadata", "Entity Metadata", SPacketEntityMetadata.class, PacketControlFactory::createEntityMetadata);
    clientbound("entity_velocity", "Entity Velocity", SPacketEntityVelocity.class);
    clientbound("spawn_experience_orb", "Spawn Experience Orb", SPacketSpawnExperienceOrb.class);
    clientbound("spawn_global_entity", "Spawn Global Entity", SPacketSpawnGlobalEntity.class);
    clientbound("spawn_mob", "Spawn Mob", SPacketSpawnMob.class);
    clientbound("spawn_object", "Spawn Object", SPacketSpawnObject.class, PacketControlFactory::createSpawnObject);
    clientbound("spawn_painting", "Spawn Painting", SPacketSpawnPainting.class);

    // Inventory
    clientbound("close_window", "Close Window", SPacketCloseWindow.class, PacketControlFactory::createCloseWindow);
    clientbound("confirm_transaction", "Confirm Transaction", SPacketConfirmTransaction.class, PacketControlFactory::createConfirmTransaction);
    clientbound("open_window", "Open Window", SPacketOpenWindow.class, PacketControlFactory::createOpenWindow);
    clientbound("set_slot", "Set Slot", SPacketSetSlot.class, PacketControlFactory::createSetSlot);
    clientbound("window_items", "Window Items", SPacketWindowItems.class, PacketControlFactory::createWindowItems);

    // Player
    clientbound("player_abilities", "Player Abilities", SPacketPlayerAbilities.class, PacketControlFactory::createPlayerAbilities);
    clientbound("spawn_player", "Spawn Player", SPacketSpawnPlayer.class);
    clientbound("use_bed", "Use Bed", SPacketUseBed.class, PacketControlFactory::createUseBed);
    clientbound("vehicle_position", "Vehicle Position", SPacketMoveVehicle.class);

    // World
    clientbound("custom_sound", "Custom Sound", SPacketCustomSound.class, PacketControlFactory::createCustomSound);
    clientbound("game_sound", "Game Sound", SPacketSoundEffect.class, PacketControlFactory::createGameSound);
    clientbound("open_sign_editor", "Open Sign Editor", SPacketSignEditorOpen.class, PacketControlFactory::createOpenSignEditor);
    clientbound("world_time", "World Time", SPacketTimeUpdate.class, PacketControlFactory::createWorldTime);

    // Client
    serverbound("click_window", "Click Window", CPacketClickWindow.class);
    serverbound("move_vehicle", "Move Vehicle", CPacketVehicleMove.class);
    serverbound("update_sign", "Update Sign", CPacketUpdateSign.class);
    serverbound("window_close", "Window Close", CPacketCloseWindow.class);
}
项目:Backmemed    文件:RealmsConnect.java   
public void connect(final String p_connect_1_, final int p_connect_2_)
{
    Realms.setConnectedToRealms(true);
    (new Thread("Realms-connect-task")
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                inetaddress = InetAddress.getByName(p_connect_1_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection = NetworkManager.createNetworkManagerAndConnect(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.isUsingNativeTransport());

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00Handshake(316, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new CPacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
            }
            catch (Exception exception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
                String s = exception.toString();

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

                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:Backmemed    文件:NetHandlerHandshakeMemory.java   
/**
 * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The
 * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention
 * must pass a versioncheck or receive a disconnect otherwise
 */
public void processHandshake(C00Handshake packetIn)
{
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}
项目:Backmemed    文件:GuiConnecting.java   
private void connect(final String ip, final int port)
{
    LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(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.createNetworkManagerAndConnect(inetaddress, port, GuiConnecting.this.mc.gameSettings.isUsingNativeTransport());
                GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
                GuiConnecting.this.networkManager.sendPacket(new C00Handshake(GuiScreenProtocol.proto, ip, port, EnumConnectionState.LOGIN));
                GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(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 TextComponentTranslation("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 + ":" + port;
                    s = s.replaceAll(s1, "");
                }

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:CustomWorldGen    文件:RealmsConnect.java   
public void connect(final String p_connect_1_, final int p_connect_2_)
{
    Realms.setConnectedToRealms(true);
    (new Thread("Realms-connect-task")
    {
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_);
                inetaddress = InetAddress.getByName(p_connect_1_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection = NetworkManager.createNetworkManagerAndConnect(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.isUsingNativeTransport());

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new C00Handshake(210, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.sendPacket(new CPacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
            }
            catch (UnknownHostException unknownhostexception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
            }
            catch (Exception exception)
            {
                Realms.clearResourcePack();

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
                String s = exception.toString();

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

                Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:CustomWorldGen    文件:GuiConnecting.java   
private void connect(final String ip, final int port)
{
    LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(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.createNetworkManagerAndConnect(inetaddress, port, GuiConnecting.this.mc.gameSettings.isUsingNativeTransport());
                GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
                GuiConnecting.this.networkManager.sendPacket(new C00Handshake(210, ip, port, EnumConnectionState.LOGIN, true));
                GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(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 TextComponentTranslation("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 + ":" + port;
                    s = s.replaceAll(s1, "");
                }

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
private void connect(final String ip, final int port) {
    LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(port)});

    new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet()) {
        @Override 
        public void run() {
            InetAddress inetaddress = null;

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

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

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

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

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

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }.start();
}
项目:morecommands    文件:PatchEntityPlayerSP.java   
@Override
public void processHandshake(C00Handshake packetIn) {
    if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;
    this.networkManager.setConnectionState(packetIn.getRequestedState());
    this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
   }
项目:Resilience-Client-Source    文件:GuiConnecting.java   
private void func_146367_a(final String p_146367_1_, final int p_146367_2_)
{
    logger.info("Connecting to " + p_146367_1_ + ", " + p_146367_2_);
    (new Thread("Server Connector #" + field_146372_a.incrementAndGet())
    {
        private static final String __OBFID = "CL_00000686";
        public void run()
        {
            try
            {
                if (GuiConnecting.this.field_146373_h)
                {
                    return;
                }

                GuiConnecting.this.field_146371_g = NetworkManager.provideLanClient(InetAddress.getByName(p_146367_1_), p_146367_2_);
                GuiConnecting.this.field_146371_g.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.mc, GuiConnecting.this.field_146374_i));
                GuiConnecting.this.field_146371_g.scheduleOutboundPacket(new C00Handshake(Resilience.getInstance().getValues().version, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN), new GenericFutureListener[0]);
                GuiConnecting.this.field_146371_g.scheduleOutboundPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().func_148256_e()), new GenericFutureListener[0]);
            }
            catch (UnknownHostException var2)
            {
                if (GuiConnecting.this.field_146373_h)
                {
                    return;
                }

                GuiConnecting.logger.error("Couldn\'t connect to server", var2);
                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.field_146374_i, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_146367_1_ + "\'"})));
            }
            catch (Exception var3)
            {
                if (GuiConnecting.this.field_146373_h)
                {
                    return;
                }

                GuiConnecting.logger.error("Couldn\'t connect to server", var3);
                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.field_146374_i, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {var3.toString()})));
            }
        }
    }).start();
}
项目:Resilience-Client-Source    文件:TaskOnlineConnect.java   
private void func_148432_a(final String p_148432_1_, final int p_148432_2_)
{
    (new Thread("MCO Connector #" + field_148439_a.incrementAndGet())
    {
        private static final String __OBFID = "CL_00000791";
        public void run()
        {
            try
            {
                if (TaskOnlineConnect.this.func_148418_c())
                {
                    return;
                }

                TaskOnlineConnect.this.field_148436_d = NetworkManager.provideLanClient(InetAddress.getByName(p_148432_1_), p_148432_2_);

                if (TaskOnlineConnect.this.func_148418_c())
                {
                    return;
                }

                TaskOnlineConnect.this.field_148436_d.setNetHandler(new NetHandlerLoginClient(TaskOnlineConnect.this.field_148436_d, TaskOnlineConnect.this.func_148413_b(), TaskOnlineConnect.this.field_148435_f));

                if (TaskOnlineConnect.this.func_148418_c())
                {
                    return;
                }

                TaskOnlineConnect.this.field_148436_d.scheduleOutboundPacket(new C00Handshake(4, p_148432_1_, p_148432_2_, EnumConnectionState.LOGIN), new GenericFutureListener[0]);

                if (TaskOnlineConnect.this.func_148418_c())
                {
                    return;
                }

                TaskOnlineConnect.this.field_148436_d.scheduleOutboundPacket(new C00PacketLoginStart(TaskOnlineConnect.this.func_148413_b().getSession().func_148256_e()), new GenericFutureListener[0]);
                TaskOnlineConnect.this.func_148417_b(I18n.format("mco.connect.authorizing", new Object[0]));
            }
            catch (UnknownHostException var2)
            {
                if (TaskOnlineConnect.this.func_148418_c())
                {
                    return;
                }

                TaskOnlineConnect.logger.error("Couldn\'t connect to world", var2);
                TaskOnlineConnect.this.func_148413_b().displayGuiScreen(new GuiScreenDisconnectedOnline(TaskOnlineConnect.this.field_148435_f, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_148432_1_ + "\'"})));
            }
            catch (Exception var3)
            {
                if (TaskOnlineConnect.this.func_148418_c())
                {
                    return;
                }

                TaskOnlineConnect.logger.error("Couldn\'t connect to world", var3);
                TaskOnlineConnect.this.func_148413_b().displayGuiScreen(new GuiScreenDisconnectedOnline(TaskOnlineConnect.this.field_148435_f, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {var3.toString()})));
            }
        }
    }).start();
}
项目:Resilience-Client-Source    文件:Minecraft.java   
/**
 * Arguments: World foldername,  World ingame name, WorldSettings
 */
public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings)
{
    this.loadWorld((WorldClient)null);
    System.gc();
    ISaveHandler var4 = this.saveLoader.getSaveLoader(par1Str, false);
    WorldInfo var5 = var4.loadWorldInfo();

    if (var5 == null && par3WorldSettings != null)
    {
        var5 = new WorldInfo(par3WorldSettings, par1Str);
        var4.saveWorldInfo(var5);
    }

    if (par3WorldSettings == null)
    {
        par3WorldSettings = new WorldSettings(var5);
    }

    try
    {
        this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings);
        this.theIntegratedServer.startServerThread();
        this.integratedServerIsRunning = true;
    }
    catch (Throwable var10)
    {
        CrashReport var7 = CrashReport.makeCrashReport(var10, "Starting integrated server");
        CrashReportCategory var8 = var7.makeCategory("Starting integrated server");
        var8.addCrashSection("Level ID", par1Str);
        var8.addCrashSection("Level Name", par2Str);
        throw new ReportedException(var7);
    }

    this.loadingScreen.displayProgressMessage(I18n.format("menu.loadingLevel", new Object[0]));

    while (!this.theIntegratedServer.serverIsInRunLoop())
    {
        String var6 = this.theIntegratedServer.getUserMessage();

        if (var6 != null)
        {
            this.loadingScreen.resetProgresAndWorkingMessage(I18n.format(var6, new Object[0]));
        }
        else
        {
            this.loadingScreen.resetProgresAndWorkingMessage("");
        }

        try
        {
            Thread.sleep(200L);
        }
        catch (InterruptedException var9)
        {
            ;
        }
    }

    this.displayGuiScreen((GuiScreen)null);
    SocketAddress var11 = this.theIntegratedServer.func_147137_ag().addLocalEndpoint();
    NetworkManager var12 = NetworkManager.provideLocalClient(var11);
    var12.setNetHandler(new NetHandlerLoginClient(var12, this, (GuiScreen)null));
    var12.scheduleOutboundPacket(new C00Handshake(4, var11.toString(), 0, EnumConnectionState.LOGIN), new GenericFutureListener[0]);
    var12.scheduleOutboundPacket(new C00PacketLoginStart(this.getSession().func_148256_e()), new GenericFutureListener[0]);
    this.myNetworkManager = var12;
}
项目:ExpandedRailsMod    文件:GuiConnecting.java   
private void connect(final String ip, final int port)
{
    LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(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.createNetworkManagerAndConnect(inetaddress, port, GuiConnecting.this.mc.gameSettings.isUsingNativeTransport());
                GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
                GuiConnecting.this.networkManager.sendPacket(new C00Handshake(210, ip, port, EnumConnectionState.LOGIN, true));
                GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(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 TextComponentTranslation("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 + ":" + port;
                    s = s.replaceAll(s1, "");
                }

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:Cauldron    文件:RealmsServerStatusPinger.java   
public void pingServer(final String p_pingServer_1_, final ServerPing p_pingServer_2_) throws IOException
{
    if (p_pingServer_1_ != null && !p_pingServer_1_.startsWith("0.0.0.0") && !p_pingServer_1_.isEmpty())
    {
        RealmsServerAddress realmsserveraddress = RealmsServerAddress.parseString(p_pingServer_1_);
        final NetworkManager networkmanager = NetworkManager.provideLanClient(InetAddress.getByName(realmsserveraddress.getHost()), realmsserveraddress.getPort());
        this.connections.add(networkmanager);
        networkmanager.setNetHandler(new INetHandlerStatusClient()
        {
            private boolean field_154345_e = false;
            private static final String __OBFID = "CL_00001807";
            public void handleServerInfo(S00PacketServerInfo p_147397_1_)
            {
                ServerStatusResponse serverstatusresponse = p_147397_1_.func_149294_c();

                if (serverstatusresponse.func_151318_b() != null)
                {
                    p_pingServer_2_.nrOfPlayers = String.valueOf(serverstatusresponse.func_151318_b().func_151333_b());
                }

                networkmanager.scheduleOutboundPacket(new C01PacketPing(Realms.currentTimeMillis()), new GenericFutureListener[0]);
                this.field_154345_e = true;
            }
            public void handlePong(S01PacketPong p_147398_1_)
            {
                networkmanager.closeChannel(new ChatComponentText("Finished"));
            }
            public void onDisconnect(IChatComponent p_147231_1_)
            {
                if (!this.field_154345_e)
                {
                    RealmsServerStatusPinger.LOGGER.error("Can\'t ping " + p_pingServer_1_ + ": " + p_147231_1_.getUnformattedText());
                }
            }
            public void onConnectionStateTransition(EnumConnectionState p_147232_1_, EnumConnectionState p_147232_2_)
            {
                if (p_147232_2_ != EnumConnectionState.STATUS)
                {
                    throw new UnsupportedOperationException("Unexpected change in protocol to " + p_147232_2_);
                }
            }
            public void onNetworkTick() {}
        });

        try
        {
            networkmanager.scheduleOutboundPacket(new C00Handshake(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION, realmsserveraddress.getHost(), realmsserveraddress.getPort(), EnumConnectionState.STATUS), new GenericFutureListener[0]);
            networkmanager.scheduleOutboundPacket(new C00PacketServerQuery(), new GenericFutureListener[0]);
        }
        catch (Throwable throwable)
        {
            LOGGER.error(throwable);
        }
    }
}
项目:Cauldron    文件:RealmsConnect.java   
public void connect(final String p_connect_1_, final int p_connect_2_)
{
    (new Thread("Realms-connect-task")
    {
        private static final String __OBFID = "CL_00001808";
        public void run()
        {
            InetAddress inetaddress = null;

            try
            {
                cpw.mods.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_);
                inetaddress = InetAddress.getByName(p_connect_1_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection = NetworkManager.provideLanClient(inetaddress, p_connect_2_);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.scheduleOutboundPacket(new C00Handshake(5, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN), new GenericFutureListener[0]);

                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.this.connection.scheduleOutboundPacket(new C00PacketLoginStart(Minecraft.getMinecraft().getSession().func_148256_e()), new GenericFutureListener[0]);
            }
            catch (UnknownHostException unknownhostexception)
            {
                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error("Couldn\'t connect to world", unknownhostexception);
                Realms.setScreen(new DisconnectedOnlineScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
            }
            catch (Exception exception)
            {
                if (RealmsConnect.this.aborted)
                {
                    return;
                }

                RealmsConnect.LOGGER.error("Couldn\'t connect to world", exception);
                String s = exception.toString();

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

                Realms.setScreen(new DisconnectedOnlineScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}
项目:Cauldron    文件:NetHandlerHandshakeMemory.java   
public void processHandshake(C00Handshake p_147383_1_)
{
    this.field_147384_b.setConnectionState(p_147383_1_.func_149594_c());
}
项目:Cauldron    文件:GuiConnecting.java   
private void func_146367_a(final String p_146367_1_, final int p_146367_2_)
{
    logger.info("Connecting to " + p_146367_1_ + ", " + p_146367_2_);
    (new Thread("Server Connector #" + field_146372_a.incrementAndGet())
    {
        private static final String __OBFID = "CL_00000686";
        public void run()
        {
            InetAddress inetaddress = null;

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

                inetaddress = InetAddress.getByName(p_146367_1_);
                GuiConnecting.this.field_146371_g = NetworkManager.provideLanClient(inetaddress, p_146367_2_);
                GuiConnecting.this.field_146371_g.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.mc, GuiConnecting.this.field_146374_i));
                GuiConnecting.this.field_146371_g.scheduleOutboundPacket(new C00Handshake(5, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN), new GenericFutureListener[0]);
                GuiConnecting.this.field_146371_g.scheduleOutboundPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().func_148256_e()), new GenericFutureListener[0]);
            }
            catch (UnknownHostException unknownhostexception)
            {
                if (GuiConnecting.this.field_146373_h)
                {
                    return;
                }

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

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

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

                GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.field_146374_i, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s})));
            }
        }
    }).start();
}