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