001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005
006 @SideOnly(Side.CLIENT)
007 public class ServerData
008 {
009 public String serverName;
010 public String serverIP;
011
012 /**
013 * the string indicating number of players on and capacity of the server that is shown on the server browser (i.e.
014 * "5/20" meaning 5 slots used out of 20 slots total)
015 */
016 public String populationInfo;
017
018 /**
019 * (better variable name would be 'hostname') server name as displayed in the server browser's second line (grey
020 * text)
021 */
022 public String serverMOTD;
023
024 /** last server ping that showed up in the server browser */
025 public long pingToServer;
026 public boolean field_78841_f = false;
027 private boolean field_78842_g = true;
028 private boolean acceptsTextures = false;
029
030 public ServerData(String par1Str, String par2Str)
031 {
032 this.serverName = par1Str;
033 this.serverIP = par2Str;
034 }
035
036 /**
037 * Returns an NBTTagCompound with the server's name, IP and maybe acceptTextures.
038 */
039 public NBTTagCompound getNBTCompound()
040 {
041 NBTTagCompound var1 = new NBTTagCompound();
042 var1.setString("name", this.serverName);
043 var1.setString("ip", this.serverIP);
044
045 if (!this.field_78842_g)
046 {
047 var1.setBoolean("acceptTextures", this.acceptsTextures);
048 }
049
050 return var1;
051 }
052
053 public boolean getAcceptsTextures()
054 {
055 return this.acceptsTextures;
056 }
057
058 public boolean func_78840_c()
059 {
060 return this.field_78842_g;
061 }
062
063 public void setAcceptsTextures(boolean par1)
064 {
065 this.acceptsTextures = par1;
066 this.field_78842_g = false;
067 }
068
069 /**
070 * Takes an NBTTagCompound with 'name' and 'ip' keys, returns a ServerData instance.
071 */
072 public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound)
073 {
074 ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"));
075
076 if (par0NBTTagCompound.hasKey("acceptTextures"))
077 {
078 var1.setAcceptsTextures(par0NBTTagCompound.getBoolean("acceptTextures"));
079 }
080
081 return var1;
082 }
083 }