net.minecraft.client.gui.screen.DisconnectedScreen Java Examples

The following examples show how to use net.minecraft.client.gui.screen.DisconnectedScreen. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onOpenScreen(EventOpenScreen event) {
	if (event.getScreen() instanceof DisconnectedScreen
			&& !(event.getScreen() instanceof newDisconnectScreen)) {
		mc.openScreen(new newDisconnectScreen((DisconnectedScreen) event.getScreen()));
		event.setCancelled(true);
	}
}
 
Example #2
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onOpenScreen(EventOpenScreen event) {
	if (event.getScreen() instanceof DisconnectedScreen
			&& !(event.getScreen() instanceof newDisconnectScreen)) {
		mc.openScreen(new newDisconnectScreen((DisconnectedScreen) event.getScreen()));
		event.setCancelled(true);
	}
}
 
Example #3
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onOpenScreen(EventOpenScreen event) {
	if (event.getScreen() instanceof DisconnectedScreen
			&& !(event.getScreen() instanceof newDisconnectScreen)) {
		mc.openScreen(new newDisconnectScreen((DisconnectedScreen) event.getScreen()));
		event.setCancelled(true);
	}
}
 
Example #4
Source File: ConnectionScreen.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void connect(final String string_1, final int int_1) {
    Log.info("Connecting to {}, {}", string_1, int_1);
    Thread thread_1 = new Thread("Server Connector #" + CONNECTOR_THREADS_COUNT.incrementAndGet()) {
        public void run() {
            InetAddress inetAddress_1 = null;

            try {
                if (ConnectionScreen.this.connectingCancelled) {
                    return;
                }

                inetAddress_1 = InetAddress.getByName(string_1);
                ConnectionScreen.this.connection = ClientConnection.connect(inetAddress_1, int_1, ConnectionScreen.this.minecraft.options.shouldUseNativeTransport());
                ConnectionScreen.this.connection.setPacketListener(new ClientLoginNetworkHandler(ConnectionScreen.this.connection, ConnectionScreen.this.minecraft, ConnectionScreen.this.parent, ConnectionScreen.this::setStatus));
                ConnectionScreen.this.connection.send(new HandshakeC2SPacket(string_1, int_1, NetworkState.LOGIN));
                ConnectionScreen.this.connection.send(new LoginHelloC2SPacket(ConnectionScreen.this.minecraft.getSession().getProfile()));
            } catch (UnknownHostException var4) {
                if (ConnectionScreen.this.connectingCancelled) {
                    return;
                }

                Log.error("Couldn't connect to server", var4);
                ConnectionScreen.this.minecraft.execute(() -> {
                    ConnectionScreen.this.minecraft.openScreen(new DisconnectedScreen(ConnectionScreen.this.parent, "connect.failed", new TranslatableText("disconnect.genericReason", new Object[]{"Unknown host"})));
                });
            } catch (Exception var5) {
                if (ConnectionScreen.this.connectingCancelled) {
                    return;
                }

                Log.error("Couldn't connect to server", var5);
                String string_1x = inetAddress_1 == null ? var5.toString() : var5.toString().replaceAll(inetAddress_1 + ":" + int_1, "");
                ConnectionScreen.this.minecraft.execute(() -> {
                    ConnectionScreen.this.minecraft.openScreen(new DisconnectedScreen(ConnectionScreen.this.parent, "connect.failed", new TranslatableText("disconnect.genericReason", new Object[]{string_1x})));
                });
            }

        }
    };
    thread_1.setUncaughtExceptionHandler(new UncaughtExceptionLogger(Log.LOG));
    thread_1.start();
}
 
Example #5
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public newDisconnectScreen(DisconnectedScreen screen) {
	super((Screen) FabricReflect.getFieldValue(screen, "field_2456", "parent"), "Disconnect",
			(Text) FabricReflect.getFieldValue(screen, "field_2457", "reason"));
	reasonH = (int) FabricReflect.getFieldValue(screen, "field_2454", "reasonHeight");
}
 
Example #6
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public newDisconnectScreen(DisconnectedScreen screen) {
	super((Screen) FabricReflect.getFieldValue(screen, "field_2456", "parent"), "Disconnect",
			(Text) FabricReflect.getFieldValue(screen, "field_2457", "reason"));
	reasonH = (int) FabricReflect.getFieldValue(screen, "field_2454", "reasonHeight");
}
 
Example #7
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public newDisconnectScreen(DisconnectedScreen screen) {
	super((Screen) FabricReflect.getFieldValue(screen, "field_2456", "parent"), "Disconnect",
			(Text) FabricReflect.getFieldValue(screen, "field_2457", "reason"));
	reasonH = (int) FabricReflect.getFieldValue(screen, "field_2454", "reasonHeight");
}