public void updateAvaliableTexturePacks()
    {
        ArrayList arraylist = new ArrayList();
        selectedTexturePack = field_77314_a;
        arraylist.add(field_77314_a);
        Iterator iterator = func_77299_i().iterator();

        do
        {
            if (!iterator.hasNext())
            {
                break;
            }

            File file = (File)iterator.next();
            String s = func_77302_a(file);

            if (s != null)
            {
                Object obj = (TexturePackBase)field_77308_f.get(s);

                if (obj == null)
                {
                    obj = file.isDirectory() ? ((Object)(new TexturePackFolder(s, file))) : ((Object)(new TexturePackCustom(s, file)));
                    field_77308_f.put(s, obj);
                }

                if (((TexturePackBase)(obj)).func_77538_c().equals(field_77312_b.gameSettings.skin))
                {
                    selectedTexturePack = ((TexturePackBase)(obj));
                }

                arraylist.add(obj);
            }
        }
        while (true);

        availableTexturePacks.removeAll(arraylist);
        TexturePackBase texturepackbase;

        for (Iterator iterator1 = availableTexturePacks.iterator(); iterator1.hasNext(); field_77308_f.remove(texturepackbase.func_77536_b()))
        {
            texturepackbase = (TexturePackBase)iterator1.next();
            texturepackbase.func_77533_a(field_77312_b.renderEngine);
        }

        availableTexturePacks = arraylist;
    }