Search in sources :

Example 6 with ServerInfo

use of net.minecraft.client.network.ServerInfo in project BleachHack by BleachDrinker420.

the class AutoReconnect method sendPacket.

@BleachSubscribe
public void sendPacket(EventPacket.Send event) {
    if (event.getPacket() instanceof HandshakeC2SPacket) {
        HandshakeC2SPacket packet = (HandshakeC2SPacket) event.getPacket();
        server = new ServerInfo("Server", packet.getAddress() + ":" + packet.getPort(), false);
    }
}
Also used : HandshakeC2SPacket(net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket) ServerInfo(net.minecraft.client.network.ServerInfo) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 7 with ServerInfo

use of net.minecraft.client.network.ServerInfo in project Client by MatHax.

the class ServerCleanUpScreen method cleanUp.

private void cleanUp() {
    for (int i = multiplayerScreen.getServerList().size() - 1; i >= 0; i--) {
        ServerInfo server = multiplayerScreen.getServerList().get(i);
        if (removeAll.checked || shouldRemove(server))
            multiplayerScreen.getServerList().remove(server);
    }
    if (rename.checked)
        for (int i = 0; i < multiplayerScreen.getServerList().size(); i++) {
            ServerInfo server = multiplayerScreen.getServerList().get(i);
            server.name = "Server Finder " + (i + 1);
        }
    saveServerList();
    client.setScreen(parent);
}
Also used : ServerInfo(net.minecraft.client.network.ServerInfo)

Example 8 with ServerInfo

use of net.minecraft.client.network.ServerInfo in project Hypnotic-Client by Hypnotic-Development.

the class ServerFinder method saveServer.

private void saveServer(String ip) {
    try {
        if (saveMode.equalsIgnoreCase("Add servers") || saveMode.equalsIgnoreCase("Both")) {
            multiplayerScreen.getServerList().add(new ServerInfo((findMode.equalsIgnoreCase("Minehut") ? "Minehut server " + valid : "Server finder " + valid), ip, false));
            multiplayerScreen.getServerList().saveFile();
        }
        if (saveMode.equalsIgnoreCase("Save to file") || saveMode.equalsIgnoreCase("Both")) {
            File serversFile = new File(Hypnotic.hypnoticDir + "/ServerFinder.txt");
            if (!serversFile.exists()) {
                serversFile.createNewFile();
            }
            BufferedWriter writer = new BufferedWriter(new FileWriter(serversFile));
            writer.write("Server " + valid + " " + ip + "/n");
            writer.close();
        }
        Hypnotic.LOGGER.log(Level.INFO, "Saved " + ip + " as Server " + valid);
        valid++;
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ServerInfo(net.minecraft.client.network.ServerInfo) FileWriter(java.io.FileWriter) File(java.io.File) IOException(java.io.IOException) BufferedWriter(java.io.BufferedWriter)

Aggregations

ServerInfo (net.minecraft.client.network.ServerInfo)8 IOException (java.io.IOException)3 MServerInfo (mathax.client.utils.network.serverfinder.MServerInfo)2 MCVersion (com.seedfinding.mccore.version.MCVersion)1 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 Path (java.nio.file.Path)1 IPAddress (mathax.client.utils.network.serverfinder.IPAddress)1 ServerList (net.minecraft.client.option.ServerList)1 HandshakeC2SPacket (net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket)1 MinecraftServerAccess (net.pl3x.minimap.mixin.MinecraftServerAccess)1 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)1