001    package net.minecraft.src;
002    
003    import cpw.mods.fml.common.Side;
004    import cpw.mods.fml.common.asm.SideOnly;
005    import java.io.File;
006    import java.io.IOException;
007    import java.io.InputStream;
008    import java.util.zip.ZipEntry;
009    import java.util.zip.ZipFile;
010    
011    @SideOnly(Side.CLIENT)
012    public class TexturePackCustom extends TexturePackImplementation
013    {
014        private ZipFile field_77550_e;
015    
016        public TexturePackCustom(String par1Str, File par2File)
017        {
018            super(par1Str, par2File, par2File.getName());
019        }
020    
021        public void func_77533_a(RenderEngine par1RenderEngine)
022        {
023            super.func_77533_a(par1RenderEngine);
024    
025            try
026            {
027                if (this.field_77550_e != null)
028                {
029                    this.field_77550_e.close();
030                }
031            }
032            catch (IOException var3)
033            {
034                ;
035            }
036    
037            this.field_77550_e = null;
038        }
039    
040        /**
041         * Gives a texture resource as InputStream.
042         */
043        public InputStream getResourceAsStream(String par1Str)
044        {
045            this.func_77549_g();
046    
047            try
048            {
049                ZipEntry var2 = this.field_77550_e.getEntry(par1Str.substring(1));
050    
051                if (var2 != null)
052                {
053                    return this.field_77550_e.getInputStream(var2);
054                }
055            }
056            catch (Exception var3)
057            {
058                ;
059            }
060    
061            return super.getResourceAsStream(par1Str);
062        }
063    
064        private void func_77549_g()
065        {
066            if (this.field_77550_e == null)
067            {
068                try
069                {
070                    this.field_77550_e = new ZipFile(this.field_77548_a);
071                }
072                catch (IOException var2)
073                {
074                    ;
075                }
076            }
077        }
078    }