Java 类net.minecraft.client.resources.Resource 实例源码

项目:RuneCraftery    文件:FallbackResourceManager.java   
public Resource func_110536_a(ResourceLocation p_110536_1_) throws IOException {
   ResourcePack var2 = null;
   ResourceLocation var3 = func_110537_b(p_110536_1_);

   for(int var4 = this.field_110540_a.size() - 1; var4 >= 0; --var4) {
      ResourcePack var5 = (ResourcePack)this.field_110540_a.get(var4);
      if(var2 == null && var5.func_110589_b(var3)) {
         var2 = var5;
      }

      if(var5.func_110589_b(p_110536_1_)) {
         InputStream var6 = null;
         if(var2 != null) {
            var6 = var2.func_110590_a(var3);
         }

         return new SimpleResource(p_110536_1_, var5.func_110590_a(p_110536_1_), var6, this.field_110539_b);
      }
   }

   throw new FileNotFoundException(p_110536_1_.toString());
}
项目:RuneCraftery    文件:Locale.java   
private void func_135028_a(List p_135028_1_) throws IOException {
   Iterator var2 = p_135028_1_.iterator();

   while(var2.hasNext()) {
      Resource var3 = (Resource)var2.next();
      this.func_135021_a(var3.func_110527_b());
   }

}
项目:RuneCraftery    文件:SimpleReloadableResourceManager.java   
public Resource func_110536_a(ResourceLocation p_110536_1_) throws IOException {
   ResourceManager var2 = (ResourceManager)this.field_110548_a.get(p_110536_1_.func_110624_b());
   if(var2 != null) {
      return var2.func_110536_a(p_110536_1_);
   } else {
      throw new FileNotFoundException(p_110536_1_.toString());
   }
}
项目:RuneCraftery    文件:SimpleTexture.java   
public void func_110551_a(ResourceManager p_110551_1_) throws IOException {
   InputStream var2 = null;

   try {
      Resource var3 = p_110551_1_.func_110536_a(this.field_110568_b);
      var2 = var3.func_110527_b();
      BufferedImage var4 = ImageIO.read(var2);
      boolean var5 = false;
      boolean var6 = false;
      if(var3.func_110528_c()) {
         try {
            TextureMetadataSection var7 = (TextureMetadataSection)var3.func_110526_a("texture");
            if(var7 != null) {
               var5 = var7.func_110479_a();
               var6 = var7.func_110480_b();
            }
         } catch (RuntimeException var11) {
            Minecraft.func_71410_x().func_98033_al().func_98235_b("Failed reading metadata of: " + this.field_110568_b, var11);
         }
      }

      TextureUtil.func_110989_a(this.func_110552_b(), var4, var5, var6);
   } finally {
      if(var2 != null) {
         var2.close();
      }

   }

}
项目:RuneCraftery    文件:SimpleTexture.java   
public void loadTexture(ResourceManager par1ResourceManager) throws IOException
{
    InputStream inputstream = null;

    try
    {
        Resource resource = par1ResourceManager.getResource(this.textureLocation);
        inputstream = resource.getInputStream();
        BufferedImage bufferedimage = ImageIO.read(inputstream);
        boolean flag = false;
        boolean flag1 = false;

        if (resource.hasMetadata())
        {
            try
            {
                TextureMetadataSection texturemetadatasection = (TextureMetadataSection)resource.getMetadata("texture");

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                Minecraft.getMinecraft().getLogAgent().logWarningException("Failed reading metadata of: " + this.textureLocation, runtimeexception);
            }
        }

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
项目:BetterNutritionMod    文件:SimpleTexture.java   
public void loadTexture(ResourceManager par1ResourceManager) throws IOException
{
    InputStream inputstream = null;

    try
    {
        Resource resource = par1ResourceManager.getResource(this.textureLocation);
        inputstream = resource.getInputStream();
        BufferedImage bufferedimage = ImageIO.read(inputstream);
        boolean flag = false;
        boolean flag1 = false;

        if (resource.hasMetadata())
        {
            try
            {
                TextureMetadataSection texturemetadatasection = (TextureMetadataSection)resource.getMetadata("texture");

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                Minecraft.getMinecraft().getLogAgent().logWarningException("Failed reading metadata of: " + this.textureLocation, runtimeexception);
            }
        }

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
项目:RuneCraftery    文件:TextureAtlasSprite.java   
public void func_130100_a(Resource p_130100_1_) throws IOException {
   this.func_130102_n();
   InputStream var2 = p_130100_1_.func_110527_b();
   AnimationMetadataSection var3 = (AnimationMetadataSection)p_130100_1_.func_110526_a("animation");
   BufferedImage var4 = ImageIO.read(var2);
   this.field_130224_d = var4.getHeight();
   this.field_130223_c = var4.getWidth();
   int[] var5 = new int[this.field_130224_d * this.field_130223_c];
   var4.getRGB(0, 0, this.field_130223_c, this.field_130224_d, var5, 0, this.field_130223_c);
   if(var3 == null) {
      if(this.field_130224_d != this.field_130223_c) {
         throw new RuntimeException("broken aspect ratio and not an animation");
      }

      this.field_110976_a.add(var5);
   } else {
      int var6 = this.field_130224_d / this.field_130223_c;
      int var7 = this.field_130223_c;
      int var8 = this.field_130223_c;
      this.field_130224_d = this.field_130223_c;
      int var10;
      if(var3.func_110473_c() > 0) {
         Iterator var9 = var3.func_130073_e().iterator();

         while(var9.hasNext()) {
            var10 = ((Integer)var9.next()).intValue();
            if(var10 >= var6) {
               throw new RuntimeException("invalid frameindex " + var10);
            }

            this.func_130099_d(var10);
            this.field_110976_a.set(var10, func_130101_a(var5, var7, var8, var10));
         }

         this.field_110982_k = var3;
      } else {
         ArrayList var11 = Lists.newArrayList();

         for(var10 = 0; var10 < var6; ++var10) {
            this.field_110976_a.add(func_130101_a(var5, var7, var8, var10));
            var11.add(new AnimationFrame(var10, -1));
         }

         this.field_110982_k = new AnimationMetadataSection(var11, this.field_130223_c, this.field_130224_d, var3.func_110469_d());
      }
   }

}
项目:RuneCraftery    文件:TextureAtlasSprite.java   
public void loadSprite(Resource par1Resource) throws IOException
{
    this.resetSprite();
    InputStream inputstream = par1Resource.getInputStream();
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)par1Resource.getMetadata("animation");
    BufferedImage bufferedimage = ImageIO.read(inputstream);
    this.height = bufferedimage.getHeight();
    this.width = bufferedimage.getWidth();
    int[] aint = new int[this.height * this.width];
    bufferedimage.getRGB(0, 0, this.width, this.height, aint, 0, this.width);

    if (animationmetadatasection == null)
    {
        if (this.height != this.width)
        {
            throw new RuntimeException("broken aspect ratio and not an animation");
        }

        this.framesTextureData.add(aint);
    }
    else
    {
        int i = this.height / this.width;
        int j = this.width;
        int k = this.width;
        this.height = this.width;
        int l;

        if (animationmetadatasection.getFrameCount() > 0)
        {
            Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                l = ((Integer)iterator.next()).intValue();

                if (l >= i)
                {
                    throw new RuntimeException("invalid frameindex " + l);
                }

                this.allocateFrameTextureData(l);
                this.framesTextureData.set(l, getFrameTextureData(aint, j, k, l));
            }

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            ArrayList arraylist = Lists.newArrayList();

            for (l = 0; l < i; ++l)
            {
                this.framesTextureData.add(getFrameTextureData(aint, j, k, l));
                arraylist.add(new AnimationFrame(l, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(arraylist, this.width, this.height, animationmetadatasection.getFrameTime());
        }
    }
}
项目:BetterNutritionMod    文件:TextureAtlasSprite.java   
public void loadSprite(Resource par1Resource) throws IOException
{
    this.resetSprite();
    InputStream inputstream = par1Resource.getInputStream();
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)par1Resource.getMetadata("animation");
    BufferedImage bufferedimage = ImageIO.read(inputstream);
    this.height = bufferedimage.getHeight();
    this.width = bufferedimage.getWidth();
    int[] aint = new int[this.height * this.width];
    bufferedimage.getRGB(0, 0, this.width, this.height, aint, 0, this.width);

    if (animationmetadatasection == null)
    {
        if (this.height != this.width)
        {
            throw new RuntimeException("broken aspect ratio and not an animation");
        }

        this.framesTextureData.add(aint);
    }
    else
    {
        int i = this.height / this.width;
        int j = this.width;
        int k = this.width;
        this.height = this.width;
        int l;

        if (animationmetadatasection.getFrameCount() > 0)
        {
            Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator();

            while (iterator.hasNext())
            {
                l = ((Integer)iterator.next()).intValue();

                if (l >= i)
                {
                    throw new RuntimeException("invalid frameindex " + l);
                }

                this.allocateFrameTextureData(l);
                this.framesTextureData.set(l, getFrameTextureData(aint, j, k, l));
            }

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            ArrayList arraylist = Lists.newArrayList();

            for (l = 0; l < i; ++l)
            {
                this.framesTextureData.add(getFrameTextureData(aint, j, k, l));
                arraylist.add(new AnimationFrame(l, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(arraylist, this.width, this.height, animationmetadatasection.getFrameTime());
        }
    }
}
项目:RuneCraftery    文件:ResourceManager.java   
Resource func_110536_a(ResourceLocation var1) throws IOException;