    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 int field_82821_f = 47;
    027        public String field_82822_g = "1.4.1";
    028        public boolean field_78841_f = false;
    029        private boolean field_78842_g = true;
    030        private boolean acceptsTextures = false;
    031        private boolean field_82823_k = false;
    032
    033        public ServerData(String par1Str, String par2Str)
    034        {
    035            this.serverName = par1Str;
    036            this.serverIP = par2Str;
    037        }
    038
    039        /**
    040         * Returns an NBTTagCompound with the server's name, IP and maybe acceptTextures.
    041         */
    042        public NBTTagCompound getNBTCompound()
    043        {
    044            NBTTagCompound var1 = new NBTTagCompound();
    045            var1.setString("name", this.serverName);
    046            var1.setString("ip", this.serverIP);
    047            var1.setBoolean("hideAddress", this.field_82823_k);
    048
    049            if (!this.field_78842_g)
    050            {
    051                var1.setBoolean("acceptTextures", this.acceptsTextures);
    052            }
    053
    054            return var1;
    055        }
    056
    057        public boolean getAcceptsTextures()
    058        {
    059            return this.acceptsTextures;
    060        }
    061
    062        public boolean func_78840_c()
    063        {
    064            return this.field_78842_g;
    065        }
    066
    067        public void setAcceptsTextures(boolean par1)
    068        {
    069            this.acceptsTextures = par1;
    070            this.field_78842_g = false;
    071        }
    072
    073        public boolean func_82820_d()
    074        {
    075            return this.field_82823_k;
    076        }
    077
    078        public void func_82819_b(boolean par1)
    079        {
    080            this.field_82823_k = par1;
    081        }
    082
    083        /**
    084         * Takes an NBTTagCompound with 'name' and 'ip' keys, returns a ServerData instance.
    085         */
    086        public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound)
    087        {
    088            ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"));
    089            var1.field_82823_k = par0NBTTagCompound.getBoolean("hideAddress");
    090
    091            if (par0NBTTagCompound.hasKey("acceptTextures"))
    092            {
    093                var1.setAcceptsTextures(par0NBTTagCompound.getBoolean("acceptTextures"));
    094            }
    095
    096            return var1;
    097        }
    098    }