net.minecraft.client.network.ServerInfo Java Examples

The following examples show how to use net.minecraft.client.network.ServerInfo. 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: ServerFinderScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void updatePingers(ArrayList<WurstServerPinger> pingers)
{
	for(int i = 0; i < pingers.size(); i++)
		if(!pingers.get(i).isStillPinging())
		{
			checked++;
			if(pingers.get(i).isWorking())
			{
				working++;
				
				if(!isServerInList(pingers.get(i).getServerIP()))
				{
					prevScreen.getServerList()
						.add(new ServerInfo("Grief me #" + working,
							pingers.get(i).getServerIP(), false));
					prevScreen.getServerList().saveFile();
					((IMultiplayerScreen)prevScreen).getServerListSelector()
						.setSelected(null);
					((IMultiplayerScreen)prevScreen).getServerListSelector()
						.setServers(prevScreen.getServerList());
				}
			}
			pingers.remove(i);
		}
}
 
Example #2
Source File: IpCmd.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private String getIP()
{
	ServerInfo lastServer = LastServerRememberer.getLastServer();
	if(lastServer == null || MC.isIntegratedServerRunning())
		return "127.0.0.1:25565";
	
	String ip = lastServer.address;
	if(!ip.contains(":"))
		ip += ":25565";
	
	return ip;
}
 
Example #3
Source File: SvCmd.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private String getVersion() throws CmdError
{
	if(MC.isIntegratedServerRunning())
		throw new CmdError("Can't check server version in singleplayer.");
	
	ServerInfo lastServer = LastServerRememberer.getLastServer();
	if(lastServer == null)
		throw new IllegalStateException(
			"LastServerRememberer doesn't remember the last server!");
	
	return lastServer.version.getString();
}
 
Example #4
Source File: WurstServerPinger.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
public void ping(String ip, int port)
{
	server = new ServerInfo("", ip + ":" + port, false);
	
	new Thread(() -> pingInCurrentThread(ip, port),
		"Wurst Server Pinger #" + threadNumber.incrementAndGet()).start();
}
 
Example #5
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void sendPacket(EventSendPacket event) {
	if (event.getPacket() instanceof HandshakeC2SPacket) {
		try { server = new ServerInfo("Server", 
				(String) FabricReflect.getFieldValue(event.getPacket(), "field_13159", "address") + ":"
				+ (int) FabricReflect.getFieldValue(event.getPacket(), "field_13157", "port"), false); } catch (Exception e) {}
	}
}
 
Example #6
Source File: ServerScraperScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void ping(String ip, int port) {
	server = new ServerInfo(ip, ip + ":" + port, false);
	System.out.println("Starting Ping " + ip + ":" + port);
	new Thread(() -> {
		MultiplayerServerListPinger pinger = new MultiplayerServerListPinger();
		try {
			pinger.add(server, () -> {});
		} catch (Exception e) {
			failed = true;
		}
		pinger.cancel();
		done = true;
		System.out.println("Finished Ping " + ip + ":" + port + " > " + failed);
	}).start();
}
 
Example #7
Source File: AutoReconnect.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void sendPacket(EventSendPacket event) {
	if (event.getPacket() instanceof HandshakeC2SPacket) {
		try { server = new ServerInfo("Server", 
				(String) FabricReflect.getFieldValue(event.getPacket(), "field_13159", "address") + ":"
				+ (int) FabricReflect.getFieldValue(event.getPacket(), "field_13157", "port"), false); } catch (Exception e) {}
	}
}
 
Example #8
Source File: ServerScraperScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void ping(String ip, int port) {
	server = new ServerInfo(ip, ip + ":" + port, false);
	System.out.println("Starting Ping " + ip + ":" + port);
	new Thread(() -> {
		MultiplayerServerListPinger pinger = new MultiplayerServerListPinger();
		try {
			pinger.add(server);
		} catch (Exception e) {
			failed = true;
		}
		pinger.cancel();
		done = true;
		System.out.println("Finished Ping " + ip + ":" + port + " > " + failed);
	}).start();
}
 
Example #9
Source File: MultiplayerScreenMixin.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void connectToServer(ServerInfo server)
{
	connect(server);
}
 
Example #10
Source File: MultiplayerScreenMixin.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Inject(at = {@At("HEAD")},
	method = {"connect(Lnet/minecraft/client/network/ServerInfo;)V"})
private void onConnect(ServerInfo entry, CallbackInfo ci)
{
	LastServerRememberer.setLastServer(entry);
}
 
Example #11
Source File: MultiplayerScreenMixin.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Shadow
private void connect(ServerInfo entry)
{
	
}
 
Example #12
Source File: IMultiplayerScreen.java    From Wurst7 with GNU General Public License v3.0 votes vote down vote up
public void connectToServer(ServerInfo server);