本文整理汇总了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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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();
}