當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureAtlasSprite.getFrameTextureData方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureAtlasSprite.getFrameTextureData方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureAtlasSprite.getFrameTextureData方法的具體用法?Java TextureAtlasSprite.getFrameTextureData怎麽用?Java TextureAtlasSprite.getFrameTextureData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.texture.TextureAtlasSprite的用法示例。


在下文中一共展示了TextureAtlasSprite.getFrameTextureData方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: func_178393_a

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private List<ItemModelGenerator.Span> func_178393_a(TextureAtlasSprite p_178393_1_)
{
    int i = p_178393_1_.getIconWidth();
    int j = p_178393_1_.getIconHeight();
    List<ItemModelGenerator.Span> list = Lists.<ItemModelGenerator.Span>newArrayList();

    for (int k = 0; k < p_178393_1_.getFrameCount(); ++k)
    {
        int[] aint = p_178393_1_.getFrameTextureData(k)[0];

        for (int l = 0; l < j; ++l)
        {
            for (int i1 = 0; i1 < i; ++i1)
            {
                boolean flag = !this.func_178391_a(aint, i1, l, i, j);
                this.func_178396_a(ItemModelGenerator.SpanFacing.UP, list, aint, i1, l, i, j, flag);
                this.func_178396_a(ItemModelGenerator.SpanFacing.DOWN, list, aint, i1, l, i, j, flag);
                this.func_178396_a(ItemModelGenerator.SpanFacing.LEFT, list, aint, i1, l, i, j, flag);
                this.func_178396_a(ItemModelGenerator.SpanFacing.RIGHT, list, aint, i1, l, i, j, flag);
            }
        }
    }

    return list;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:26,代碼來源:ItemModelGenerator.java

示例2: getSpans

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private List<ItemModelGenerator.Span> getSpans(TextureAtlasSprite p_178393_1_)
{
    int i = p_178393_1_.getIconWidth();
    int j = p_178393_1_.getIconHeight();
    List<ItemModelGenerator.Span> list = Lists.<ItemModelGenerator.Span>newArrayList();

    for (int k = 0; k < p_178393_1_.getFrameCount(); ++k)
    {
        int[] aint = p_178393_1_.getFrameTextureData(k)[0];

        for (int l = 0; l < j; ++l)
        {
            for (int i1 = 0; i1 < i; ++i1)
            {
                boolean flag = !this.isTransparent(aint, i1, l, i, j);
                this.checkTransition(ItemModelGenerator.SpanFacing.UP, list, aint, i1, l, i, j, flag);
                this.checkTransition(ItemModelGenerator.SpanFacing.DOWN, list, aint, i1, l, i, j, flag);
                this.checkTransition(ItemModelGenerator.SpanFacing.LEFT, list, aint, i1, l, i, j, flag);
                this.checkTransition(ItemModelGenerator.SpanFacing.RIGHT, list, aint, i1, l, i, j, flag);
            }
        }
    }

    return list;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:ItemModelGenerator.java

示例3: dbgMipmaps

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
public static void dbgMipmaps(TextureAtlasSprite p_dbgMipmaps_0_)
{
    int[][] aint = p_dbgMipmaps_0_.getFrameTextureData(0);

    for (int i = 0; i < aint.length; ++i)
    {
        int[] aint1 = aint[i];

        if (aint1 == null)
        {
            Config.dbg("" + i + ": " + aint1);
        }
        else
        {
            Config.dbg("" + i + ": " + aint1.length);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:TextureUtils.java

示例4: convertTextureHorizontal

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
/**
 * Scans a texture and converts it into a list of horizontal strips stacked on top of each other.
 * The height of the strips is as big as possible.
 */
public static List<UnpackedBakedQuad> convertTextureHorizontal(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color)
{
    int w = template.getIconWidth();
    int h = template.getIconHeight();
    float wScale = 16f / (float)w;
    float hScale = 16f / (float)h;
    int[] data = template.getFrameTextureData(0)[0];
    List<UnpackedBakedQuad> quads = Lists.newArrayList();

    // the upper left x-position of the current quad
    int start = -1;
    for (int y = 0; y < h; y++)
    {
        for (int x = 0; x < w; x++)
        {
            // current pixel
            int pixel = data[y * w + x];

            // no current quad but found a new one
            if (start < 0 && isVisible(pixel))
            {
                start = x;
            }
            // got a current quad, but it ends here
            if (start >= 0 && !isVisible(pixel))
            {
                // we now check if the visibility of the next row matches the one fo the current row
                // if they are, we can extend the quad downwards
                int endY = y + 1;
                boolean sameRow = true;
                while (sameRow)
                {
                    for (int i = 0; i < w; i++)
                    {
                        int px1 = data[y * w + i];
                        int px2 = data[endY * w + i];
                        if (isVisible(px1) != isVisible(px2))
                        {
                            sameRow = false;
                            break;
                        }
                    }
                    if (sameRow)
                    {
                        endY++;
                    }
                }

                // create the quad
                quads.add(genQuad(format, transform,
                                  (float)start * wScale,
                                  (float)y * hScale,
                                  (float)x * wScale,
                                  (float)endY * hScale,
                                  z, sprite, facing, color));

                // update Y if all the rows match. no need to rescan
                if (endY - y > 1)
                {
                    y = endY - 1;
                }
                // clear current quad
                start = -1;
            }
        }
    }

    return quads;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:74,代碼來源:ItemTextureQuadConverter.java

示例5: convertTextureVertical

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
/**
 * Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right.
 * The width of the strips is as big as possible.
 */
public static List<UnpackedBakedQuad> convertTextureVertical(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color)
{
    int w = template.getIconWidth();
    int h = template.getIconHeight();
    float wScale = 16f / (float)w;
    float hScale = 16f / (float)h;
    int[] data = template.getFrameTextureData(0)[0];
    List<UnpackedBakedQuad> quads = Lists.newArrayList();

    // the upper left y-position of the current quad
    int start = -1;
    for (int x = 0; x < w; x++)
    {
        for (int y = 0; y < h; y++)
        {
            // current pixel
            int pixel = data[y * w + x];

            // no current quad but found a new one
            if (start < 0 && isVisible(pixel))
            {
                start = y;
            }
            // got a current quad, but it ends here
            if (start >= 0 && !isVisible(pixel))
            {
                // we now check if the visibility of the next column matches the one fo the current row
                // if they are, we can extend the quad downwards
                int endX = x + 1;
                boolean sameColumn = true;
                while (sameColumn)
                {
                    for (int i = 0; i < h; i++)
                    {
                        int px1 = data[i * w + x];
                        int px2 = data[i * w + endX];
                        if (isVisible(px1) != isVisible(px2))
                        {
                            sameColumn = false;
                            break;
                        }
                    }
                    if (sameColumn)
                    {
                        endX++;
                    }
                }

                // create the quad
                quads.add(genQuad(format, transform,
                                  (float)x * wScale,
                                  (float)start * hScale,
                                  (float)endX * wScale,
                                  (float)y * hScale,
                                  z, sprite, facing, color));

                // update X if all the columns match. no need to rescan
                if (endX - x > 1)
                {
                    x = endX - 1;
                }
                // clear current quad
                start = -1;
            }
        }
    }

    return quads;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:74,代碼來源:ItemTextureQuadConverter.java

示例6: getQuadsForSprite

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
public static ImmutableList<BakedQuad> getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, Optional<TRSRTransformation> transform)
{
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    int uMax = sprite.getIconWidth();
    int vMax = sprite.getIconHeight();

    BitSet faces = new BitSet((uMax + 1) * (vMax + 1) * 4);
    for(int f = 0; f < sprite.getFrameCount(); f++)
    {
        int[] pixels = sprite.getFrameTextureData(f)[0];
        boolean ptu;
        boolean[] ptv = new boolean[uMax];
        Arrays.fill(ptv, true);
        for(int v = 0; v < vMax; v++)
        {
            ptu = true;
            for(int u = 0; u < uMax; u++)
            {
                boolean t = isTransparent(pixels, uMax, vMax, u, v);
                if(ptu && !t) // left - transparent, right - opaque
                {
                    addSideQuad(builder, faces, format, transform, EnumFacing.WEST, tint, sprite, uMax, vMax, u, v);
                }
                if(!ptu && t) // left - opaque, right - transparent
                {
                    addSideQuad(builder, faces, format, transform, EnumFacing.EAST, tint, sprite, uMax, vMax, u, v);
                }
                if(ptv[u] && !t) // up - transparent, down - opaque
                {
                    addSideQuad(builder, faces, format, transform, EnumFacing.UP, tint, sprite, uMax, vMax, u, v);
                }
                if(!ptv[u] && t) // up - opaque, down - transparent
                {
                    addSideQuad(builder, faces, format, transform, EnumFacing.DOWN, tint, sprite, uMax, vMax, u, v);
                }
                ptu = t;
                ptv[u] = t;
            }
            if(!ptu) // last - opaque
            {
                addSideQuad(builder, faces, format, transform, EnumFacing.EAST, tint, sprite, uMax, vMax, uMax, v);
            }
        }
        // last line
        for(int u = 0; u < uMax; u++)
        {
            if(!ptv[u])
            {
                addSideQuad(builder, faces, format, transform, EnumFacing.DOWN, tint, sprite, uMax, vMax, u, vMax);
            }
        }
    }
    // front
    builder.add(buildQuad(format, transform, EnumFacing.NORTH, sprite, tint,
        0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
        0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(),
        1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
        1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV()
    ));
    // back
    builder.add(buildQuad(format, transform, EnumFacing.SOUTH, sprite, tint,
        0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
        1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(),
        1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
        0, 1, 8.5f / 16f, sprite.getMinU(), sprite.getMinV()
    ));
    return builder.build();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:70,代碼來源:ItemLayerModel.java


注:本文中的net.minecraft.client.renderer.texture.TextureAtlasSprite.getFrameTextureData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。