MinecraftClient client = MinecraftClient.getInstance();
Screen screen = client.currentScreen;
InetSocketAddress inetSocketAddress;
try {
Optional<InetSocketAddress> optional = AllowedAddressResolver.DEFAULT.resolve(address).map(Address::getInetSocketAddress);
inetSocketAddress = optional.get();
ClientConnection connection = ClientConnection.connect(inetSocketAddress, client.options.shouldUseNativeTransport());
connection.setPacketListener(new ClientLoginNetworkHandler(connection, client, info, screen, false, null, CurrentClass::setStatus));
connection.send(new HandshakeC2SPacket(inetSocketAddress.getHostName(), inetSocketAddress.getPort(), NetworkState.LOGIN));
connection.send(new LoginHelloC2SPacket(client.getSession().getUsername(), Optional.ofNullable(client.getSession().getUuidOrNull())));
} catch (Exception var6) {
}
private static void setStatus(Text status) {
LOGGER.info("Reconnected to server: " + status.getString());
}
private static ServerInfo info = new ServerInfo("name", "ip", false);
private static ServerAddress address = ServerAddress.parse("ip");