use of net.minecraft.network.handshake.client.C00Handshake in project 3arthh4ck by 3arthqu4ke.
the class GuiConnectingPingBypass method connect.
/**
* Connects to the given server via PingBypass.
*
* @param proxyIP the pingbypass ip.
* @param proxyPort the pingbypass port.
* @param actualIP ip of the server we want to connect to.
* @param actualPort port of the server we want to connect to.
*/
private void connect(final String proxyIP, final int proxyPort, final String actualIP, final int actualPort) {
LOGGER.info("Connecting to PingBypass: {}, {}", proxyIP, proxyPort);
(new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet()) {
public void run() {
InetAddress inetaddress = null;
try {
if (cancel) {
return;
}
inetaddress = InetAddress.getByName(proxyIP);
networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, proxyPort, mc.gameSettings.isUsingNativeTransport());
networkManager.setNetHandler(new NetHandlerLoginClient(networkManager, mc, previousGuiScreen));
networkManager.sendPacket(new C00Handshake(actualIP, actualPort, EnumConnectionState.LOGIN, true));
networkManager.sendPacket(new CPacketLoginStart(mc.getSession().getProfile()));
} catch (UnknownHostException e) {
if (cancel) {
return;
}
LOGGER.error("Couldn't connect to PingBypass", e);
mc.addScheduledTask(() -> mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", "Unknown host"))));
} catch (Exception exception) {
if (cancel) {
return;
}
LOGGER.error("Couldn't connect to PingBypass", exception);
String s = exception.toString();
if (inetaddress != null) {
String s1 = inetaddress + ":" + proxyPort;
s = s.replace(s1, "");
}
String finalS = s;
mc.addScheduledTask(() -> mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", finalS))));
}
}
}).start();
}
use of net.minecraft.network.handshake.client.C00Handshake in project Almura by AlmuraDev.
the class ConnectingGui method connect.
private void connect(final String ip, final int port) {
LOGGER.info("Connecting to {}, {}", ip, Integer.valueOf(port));
(new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet()) {
public void run() {
InetAddress inetaddress = null;
try {
if (ConnectingGui.this.cancel) {
return;
}
inetaddress = InetAddress.getByName(ip);
if (Almura.networkManager != null) {
Almura.networkManager = null;
}
Almura.networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, ConnectingGui.this.mc.gameSettings.isUsingNativeTransport());
Almura.networkManager.setNetHandler(new NetHandlerLoginClient(Almura.networkManager, ConnectingGui.this.mc, ConnectingGui.this.previousGuiScreen));
Almura.networkManager.sendPacket(new C00Handshake(ip, port, EnumConnectionState.LOGIN));
Almura.networkManager.sendPacket(new CPacketLoginStart(ConnectingGui.this.mc.getSession().getProfile()));
} catch (UnknownHostException unknownhostexception) {
if (ConnectingGui.this.cancel) {
return;
}
ConnectingGui.LOGGER.error("Couldn't connect to server", (Throwable) unknownhostexception);
new DisconnectedGui("Could not connect to server.").display();
} catch (Exception exception) {
if (ConnectingGui.this.cancel) {
return;
}
ConnectingGui.LOGGER.error("Couldn't connect to server", (Throwable) exception);
String s = exception.toString();
if (inetaddress != null) {
String s1 = inetaddress + ":" + port;
s = s.replaceAll(s1, "");
}
new DisconnectedGui("Exception encountered. Could not connect to server.").display();
}
}
}).start();
}
use of net.minecraft.network.handshake.client.C00Handshake in project LiquidBouncePlus by WYSI-Foundation.
the class BungeeCordSpoof method onPacket.
@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("-", "");
}
}
use of net.minecraft.network.handshake.client.C00Handshake in project LiquidBouncePlus by WYSI-Foundation.
the class MixinGuiConnecting method connect.
/*
@Inject(method = "connect", at = @At(value = "NEW", target = "net/minecraft/network/login/client/C00PacketLoginStart"), cancellable = true)
private void mcLeaks(CallbackInfo callbackInfo) {
if(MCLeaks.isAltActive()) {
networkManager.sendPacket(new C00PacketLoginStart(new GameProfile(null, MCLeaks.getSession().getUsername())));
callbackInfo.cancel();
}
}
*/
/**
* @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(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();
}
use of net.minecraft.network.handshake.client.C00Handshake in project UtilityClient2 by Utility-Client.
the class GuiConnecting method connect.
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();
}
Aggregations