use of net.minecraft.client.multiplayer.ServerData in project Hyperium by HyperiumClient.
the class HyperiumServerList method saveSingleServer.
public static void saveSingleServer(ServerData serverData) {
ServerList serverlist = new ServerList(Minecraft.getMinecraft());
serverlist.loadServerList();
for (int i = 0; i < serverlist.countServers(); ++i) {
ServerData serverdata = serverlist.getServerData(i);
if (serverdata.serverName.equals(serverData.serverName) && serverdata.serverIP.equals(serverData.serverIP)) {
serverlist.func_147413_a(i, serverData);
break;
}
}
serverlist.saveServerList();
}
use of net.minecraft.client.multiplayer.ServerData in project Hyperium by HyperiumClient.
the class HyperiumServerList method saveServerList.
public void saveServerList(List<ServerData> servers, Minecraft mc) {
try {
NBTTagList nbttaglist = new NBTTagList();
for (ServerData server : servers) {
NBTTagCompound nbtCompound = server.getNBTCompound();
nbttaglist.appendTag(nbtCompound);
}
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setTag("servers", nbttaglist);
CompressedStreamTools.safeWrite(nbttagcompound, new File(mc.mcDataDir, "servers.dat"));
} catch (Exception exception) {
Hyperium.LOGGER.error("Save server list error", exception);
}
}
Aggregations