当前位置: 首页>>代码示例>>Java>>正文


Java IResource.getMetadata方法代码示例

本文整理汇总了Java中net.minecraft.client.resources.IResource.getMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java IResource.getMetadata方法的具体用法?Java IResource.getMetadata怎么用?Java IResource.getMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.resources.IResource的用法示例。


在下文中一共展示了IResource.getMetadata方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public boolean load(final IResourceManager manager, final ResourceLocation oldlocation) {
    ResourceLocation location = new ResourceLocation(this.baseIcon);
    location = this.completeResourceLocation(location);
    try {
        final int mipmapLevels = Minecraft.getMinecraft().gameSettings.mipmapLevels;
        final int anisotropicFiltering = Minecraft.getMinecraft().gameSettings.anisotropicFiltering;
        final IResource iresource = manager.getResource(location);
        final BufferedImage[] abufferedimage = new BufferedImage[1 + mipmapLevels];
        abufferedimage[0] = ImageIO.read(iresource.getInputStream());
        final AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation");
        abufferedimage[0] = this.processImage(abufferedimage[0], animationmetadatasection);
        this.loadSprite(abufferedimage, animationmetadatasection, anisotropicFiltering > 1.0f);
    }
    catch (RuntimeException runtimeexception) {
        FMLClientHandler.instance().trackBrokenTexture(location, runtimeexception.getMessage());
        return true;
    }
    catch (IOException ioexception1) {
        FMLClientHandler.instance().trackMissingTexture(location);
        return true;
    }
    return false;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:24,代码来源:TextureDerived.java

示例2: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    this.deleteGlTexture();
    IResource iresource = null;

    try
    {
        iresource = resourceManager.getResource(this.textureLocation);
        BufferedImage bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream());
        boolean flag = false;
        boolean flag1 = false;

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

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                LOG.warn("Failed reading metadata of: {}", new Object[] {this.textureLocation, runtimeexception});
            }
        }

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:SimpleTexture.java

示例3: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    this.deleteGlTexture();
    InputStream inputstream = null;

    try
    {
        IResource iresource = resourceManager.getResource(this.textureLocation);
        inputstream = iresource.getInputStream();
        BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream);
        boolean flag = false;
        boolean flag1 = false;

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

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                logger.warn((String)("Failed reading metadata of: " + this.textureLocation), (Throwable)runtimeexception);
            }
        }

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:42,代码来源:SimpleTexture.java

示例4: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    this.deleteGlTexture();
    InputStream inputstream = null;

    try
    {
        IResource iresource = resourceManager.getResource(this.textureLocation);
        inputstream = iresource.getInputStream();
        BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream);
        boolean flag = false;
        boolean flag1 = false;

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

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                logger.warn((String)("Failed reading metadata of: " + this.textureLocation), (Throwable)runtimeexception);
            }
        }

        if (Config.isShaders())
        {
            ShadersTex.loadSimpleTexture(this.getGlTextureId(), bufferedimage, flag, flag1, resourceManager, this.textureLocation, this.getMultiTexID());
        }
        else
        {
            TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
        }
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:49,代码来源:SimpleTexture.java

示例5: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    this.deleteGlTexture();
    IResource iresource = null;

    try
    {
        iresource = resourceManager.getResource(this.textureLocation);
        BufferedImage bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream());
        boolean flag = false;
        boolean flag1 = false;

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

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                LOG.warn("Failed reading metadata of: {}", new Object[] {this.textureLocation, runtimeexception});
            }
        }

        if (Config.isShaders())
        {
            ShadersTex.loadSimpleTexture(this.getGlTextureId(), bufferedimage, flag, flag1, resourceManager, this.textureLocation, this.getMultiTexID());
        }
        else
        {
            TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
        }
    }
    finally
    {
        IOUtils.closeQuietly((Closeable)iresource);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:45,代码来源:SimpleTexture.java

示例6: loadSpriteFrames

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadSpriteFrames(IResource resource, int mipmaplevels) throws IOException
{
    BufferedImage bufferedimage = TextureUtil.readBufferedImage(resource.getInputStream());
    AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)resource.getMetadata("animation");
    int[][] aint = new int[mipmaplevels][];
    aint[0] = new int[bufferedimage.getWidth() * bufferedimage.getHeight()];
    bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), aint[0], 0, bufferedimage.getWidth());

    if (animationmetadatasection == null)
    {
        this.framesTextureData.add(aint);
    }
    else
    {
        int i = bufferedimage.getHeight() / this.width;

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

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

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

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

            this.animationMetadata = animationmetadatasection;
        }
        else
        {
            List<AnimationFrame> list = Lists.<AnimationFrame>newArrayList();

            for (int k = 0; k < i; ++k)
            {
                this.framesTextureData.add(getFrameTextureData(aint, this.width, this.width, k));
                list.add(new AnimationFrame(k, -1));
            }

            this.animationMetadata = new AnimationMetadataSection(list, this.width, this.height, animationmetadatasection.getFrameTime(), animationmetadatasection.isInterpolate());
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:50,代码来源:TextureAtlasSprite.java

示例7: load

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public boolean load(final IResourceManager manager, final ResourceLocation location) {
    final int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
    try {
        final IResource iresource = manager.getResource(location);
        final BufferedImage[] abufferedimage = new BufferedImage[1 + Minecraft.getMinecraft().gameSettings.mipmapLevels];
        abufferedimage[0] = ImageIO.read(iresource.getInputStream());
        final TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture");
        final AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation");
        this.loadSprite(abufferedimage, animationmetadatasection, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f);
    }
    catch (IOException e) {
        try {
            final IResource iresource2 = manager.getResource(this.textureLocation);
            final BufferedImage[] abufferedimage2 = new BufferedImage[1 + Minecraft.getMinecraft().gameSettings.mipmapLevels];
            abufferedimage2[0] = ImageIO.read(iresource2.getInputStream());
            final TextureMetadataSection texturemetadatasection2 = (TextureMetadataSection)iresource2.getMetadata("texture");
            final AnimationMetadataSection animationmetadatasection2 = (AnimationMetadataSection)iresource2.getMetadata("animation");
            this.loadSprite(abufferedimage2, animationmetadatasection2, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f);
        }
        catch (IOException e2) {
            e.printStackTrace();
            return true;
        }
        final float nh = this.n / 8.5f;
        final float br = 1.0f - nh;
        for (int j = 0; j < this.framesTextureData.size(); ++j) {
            final int[] image = new int[((int[][])this.framesTextureData.get(j))[0].length];
            for (int i = 0; i < image.length; ++i) {
                final int x = i % this.width;
                final int y = i / this.height;
                final int l = ((int[][])this.framesTextureData.get(j))[0][i];
                float r = (-l >> 16 & 0xFF) / 255.0f;
                float g = (-l >> 8 & 0xFF) / 255.0f;
                float b = (-l & 0xFF) / 255.0f;
                final float dx = 2 * x / (this.width - 1) - 1.0f;
                final float dy = 2 * y / (this.height - 1) - 1.0f;
                float db = Math.max(Math.abs(dx), Math.abs(dy));
                db = Math.max(db, (float)Math.sqrt(dx * dx + dy * dy) / 1.4f);
                float d = 1.0f - db + 1.0f - nh;
                final float rb = 1.0f - (2 + this.n) / 32.0f;
                float k = 1.0f;
                if (db > rb) {
                    k = 0.7f + 0.1f * (db - rb) / (1.0f - rb);
                }
                d *= k * k;
                if (d > 1.0f) {
                    d = 1.0f;
                }
                else if (d < 0.0f) {
                    d = 0.0f;
                }
                r = 1.0f - (1.0f - r) * br * d;
                g = 1.0f - (1.0f - g) * br * d;
                b = 1.0f - (1.0f - b) * br * d;
                image[i] = -((int)(r * 255.0f) << 16 | (int)(g * 255.0f) << 8 | (int)(b * 255.0f));
            }
            final int[][] aint = new int[1 + mp][];
            aint[0] = image;
            this.framesTextureData.set(j, aint);
        }
    }
    return false;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:64,代码来源:TextureComprBlock.java

示例8: load

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public boolean load(final IResourceManager manager, final ResourceLocation location) {
    String s1 = "minecraft";
    String s2 = this.name;
    final int ind = this.name.indexOf(58);
    if (ind >= 0) {
        s2 = this.name.substring(ind + 1, this.name.length());
        if (ind > 1) {
            s1 = this.name.substring(0, ind);
        }
    }
    final int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
    s1 = s1.toLowerCase();
    s2 = "textures/" + this.directory + "/" + s2 + ".png";
    try {
        final IResource iresource = manager.getResource(new ResourceLocation(s1, s2));
        final BufferedImage[] abufferedimage = new BufferedImage[1 + mp];
        abufferedimage[0] = ImageIO.read(iresource.getInputStream());
        final AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation");
        this.loadSprite(abufferedimage, animationmetadatasection, Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0f);
    }
    catch (IOException e) {
        return true;
    }
    for (int j = 0; j < this.framesTextureData.size(); ++j) {
        final int[] image = new int[((int[][])this.framesTextureData.get(j))[0].length];
        float min_m = 1.0f;
        float max_m = 0.0f;
        for (int i = 0; i < image.length; ++i) {
            final int l = ((int[][])this.framesTextureData.get(j))[0][i];
            if (l < 0) {
                float r = (-l >> 16 & 0xFF) / 255.0f;
                float g = (-l >> 8 & 0xFF) / 255.0f;
                float b = (-l & 0xFF) / 255.0f;
                r = 1.0f - r;
                g = 1.0f - g;
                b = 1.0f - b;
                final float m = r * 0.2126f + g * 0.7152f + b * 0.0722f;
                if (m > max_m) {
                    max_m = m;
                }
                if (m < min_m) {
                    min_m = m;
                }
            }
        }
        if (min_m == 1.0f && max_m == 0.0f) {
            return false;
        }
        if (max_m == min_m) {
            max_m = min_m + 0.001f;
        }
        final float new_max_m = Math.min(max_m * this.scale, 1.0f);
        final float new_min_m = min_m / max_m * new_max_m;
        for (int k = 0; k < image.length; ++k) {
            final int l2 = ((int[][])this.framesTextureData.get(j))[0][k];
            if (l2 < 0) {
                float r2 = (-l2 >> 16 & 0xFF) / 255.0f;
                float g2 = (-l2 >> 8 & 0xFF) / 255.0f;
                float b2 = (-l2 & 0xFF) / 255.0f;
                r2 = 1.0f - r2;
                g2 = 1.0f - g2;
                b2 = 1.0f - b2;
                float m2 = r2 * 0.2126f + g2 * 0.7152f + b2 * 0.0722f;
                final float dm = (m2 - min_m) / (max_m - min_m);
                m2 = new_min_m + dm * (new_max_m - new_min_m);
                g2 = (r2 = (b2 = Math.max(Math.min(0.975f, m2), 0.025f)));
                r2 = 1.0f - r2;
                g2 = 1.0f - g2;
                b2 = 1.0f - b2;
                image[k] = -((int)(r2 * 255.0f) << 16 | (int)(g2 * 255.0f) << 8 | (int)(b2 * 255.0f));
            }
        }
        final int[][] aint = new int[1 + mp][];
        aint[0] = image;
        this.framesTextureData.set(j, aint);
    }
    return false;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:79,代码来源:TextureColorBlockBase.java

示例9: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadTexture(IResourceManager par1ResourceManager) throws IOException
{
    this.func_147631_c();
    InputStream var2 = null;

    try
    {
        IResource var3 = par1ResourceManager.getResource(this.textureLocation);
        var2 = var3.getInputStream();
        BufferedImage var4 = ImageIO.read(var2);
        boolean var5 = false;
        boolean var6 = false;

        if (var3.hasMetadata())
        {
            try
            {
                TextureMetadataSection var7 = (TextureMetadataSection)var3.getMetadata("texture");

                if (var7 != null)
                {
                    var5 = var7.getTextureBlur();
                    var6 = var7.getTextureClamp();
                }
            }
            catch (RuntimeException var11)
            {
                logger.warn("Failed reading metadata of: " + this.textureLocation, var11);
            }
        }

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), var4, var5, var6);
    }
    finally
    {
        if (var2 != null)
        {
            var2.close();
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:42,代码来源:SimpleTexture.java

示例10: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
@Override
public void loadTexture(IResourceManager resourceManager) throws IOException {
    this.deleteGlTexture();
    InputStream inputstream = null;

    try
    {
        IResource iresource = resourceManager.getResource(this.textureLocation);
        inputstream = iresource.getInputStream();
        BufferedImage bufferedimage = manipulateImage(resourceManager, ImageIO.read(inputstream));

        boolean flag = false;
        boolean flag1 = false;

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

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

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:43,代码来源:GolemGuiTexture.java

示例11: loadTexture

import net.minecraft.client.resources.IResource; //导入方法依赖的package包/类
public void loadTexture(IResourceManager p_110551_1_) throws IOException
{
    this.deleteGlTexture();
    InputStream inputstream = null;

    try
    {
        IResource iresource = p_110551_1_.getResource(this.textureLocation);
        inputstream = iresource.getInputStream();
        BufferedImage bufferedimage = ImageIO.read(inputstream);
        boolean flag = false;
        boolean flag1 = false;

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

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

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:42,代码来源:SimpleTexture.java


注:本文中的net.minecraft.client.resources.IResource.getMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。