net.minecraft.network.EnumConnectionState Java Examples
The following examples show how to use
net.minecraft.network.EnumConnectionState.
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: ReconnectModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void sendPacket(EventSendPacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof C00Handshake) { final C00Handshake packet = (C00Handshake) event.getPacket(); if (packet.getRequestedState() == EnumConnectionState.LOGIN) { this.lastIp = packet.ip; this.lastPort = packet.port; } } } }
Example #2
Source File: BungeeCordSpoof.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@EventTarget public void onPacket(PacketEvent event) { final Packet<?> packet = event.getPacket(); if(packet instanceof C00Handshake && enabled && ((C00Handshake) packet).getRequestedState() == EnumConnectionState.LOGIN) { final C00Handshake handshake = (C00Handshake) packet; handshake.ip = handshake.ip + "\000" + MessageFormat.format("{0}.{1}.{2}.{3}", getRandomIpPart(), getRandomIpPart(), getRandomIpPart(), getRandomIpPart()) + "\000" + mc.getSession().getPlayerID().replace("-", ""); } }
Example #3
Source File: MixinGuiConnecting.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite private void connect(final String ip, final int port) { logger.info("Connecting to " + ip + ", " + port); new Thread(() -> { InetAddress inetaddress = null; try { if(cancel) { return; } inetaddress = InetAddress.getByName(ip); networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, mc.gameSettings.isUsingNativeTransport()); networkManager.setNetHandler(new NetHandlerLoginClient(networkManager, mc, previousGuiScreen)); networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); networkManager.sendPacket(new C00PacketLoginStart(MCLeaks.isAltActive() ? new GameProfile(null, MCLeaks.getSession().getUsername()) : mc.getSession().getProfile())); }catch(UnknownHostException unknownhostexception) { if(cancel) return; logger.error("Couldn\'t connect to server", unknownhostexception); mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", "Unknown host"))); }catch(Exception exception) { if(cancel) { return; } logger.error("Couldn\'t connect to server", exception); String s = exception.toString(); if(inetaddress != null) { String s1 = inetaddress.toString() + ":" + port; s = s.replaceAll(s1, ""); } mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", s))); } }, "Server Connector #" + CONNECTION_ID.incrementAndGet()).start(); }
Example #4
Source File: MixinNetworkManager.java From VanillaFix with MIT License | 4 votes |
/** * @reason forces reading of the channel when we enable autoread * Fixes issue with stuck "Logging in..." screen */ @Inject(method = "setConnectionState", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelConfig;setAutoRead(Z)Lio/netty/channel/ChannelConfig;", shift = At.Shift.AFTER)) private void onAutoReadEnabled(EnumConnectionState newState, CallbackInfo ci) { this.channel.read(); }
Example #5
Source File: MixinNetHandlerLoginClient.java From VanillaFix with MIT License | 4 votes |
/** * @reason forces reading of the channel when we enable autoread * Fixes issue with stuck "Logging in..." screen */ @Inject(method = "handleLoginSuccess", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkManager;setNetHandler(Lnet/minecraft/network/INetHandler;)V", shift = At.Shift.AFTER)) private void onNetHandlerSet(SPacketLoginSuccess packetIn, CallbackInfo ci) { this.networkManager.setConnectionState(EnumConnectionState.PLAY); }
Example #6
Source File: FakeNetServerHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onConnectionStateTransition(EnumConnectionState p_147232_1_, EnumConnectionState p_147232_2_) { }
Example #7
Source File: FakeNetServerHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void setConnectionState(EnumConnectionState p_150723_1_) { }
Example #8
Source File: MixinGuiConnecting.java From LiquidBounce with GNU General Public License v3.0 | 1 votes |
/** * @author CCBlueX */ @Overwrite private void connect(final String ip, final int port) { logger.info("Connecting to " + ip + ", " + port); new Thread(() -> { InetAddress inetaddress = null; try { if(cancel) { return; } inetaddress = InetAddress.getByName(ip); networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, mc.gameSettings.isUsingNativeTransport()); networkManager.setNetHandler(new NetHandlerLoginClient(networkManager, mc, previousGuiScreen)); networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); networkManager.sendPacket(new C00PacketLoginStart(MCLeaks.isAltActive() ? new GameProfile(null, MCLeaks.getSession().getUsername()) : mc.getSession().getProfile())); }catch(UnknownHostException unknownhostexception) { if(cancel) return; logger.error("Couldn\'t connect to server", unknownhostexception); mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", "Unknown host"))); }catch(Exception exception) { if(cancel) { return; } logger.error("Couldn\'t connect to server", exception); String s = exception.toString(); if(inetaddress != null) { String s1 = inetaddress.toString() + ":" + port; s = s.replaceAll(s1, ""); } mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", s))); } }, "Server Connector #" + CONNECTION_ID.incrementAndGet()).start(); }