本文整理汇总了Java中net.minecraft.client.renderer.texture.TextureAtlasSprite.getFrameCount方法的典型用法代码示例。如果您正苦于以下问题:Java TextureAtlasSprite.getFrameCount方法的具体用法?Java TextureAtlasSprite.getFrameCount怎么用?Java TextureAtlasSprite.getFrameCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.texture.TextureAtlasSprite
的用法示例。
在下文中一共展示了TextureAtlasSprite.getFrameCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: generateCustomMipmaps
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
public static void generateCustomMipmaps(TextureAtlasSprite p_generateCustomMipmaps_0_, int p_generateCustomMipmaps_1_)
{
int i = p_generateCustomMipmaps_0_.getIconWidth();
int j = p_generateCustomMipmaps_0_.getIconHeight();
if (p_generateCustomMipmaps_0_.getFrameCount() < 1)
{
List<int[][]> list = new ArrayList();
int[][] aint = new int[p_generateCustomMipmaps_1_ + 1][];
int[] aint1 = new int[i * j];
aint[0] = aint1;
list.add(aint);
p_generateCustomMipmaps_0_.setFramesTextureData(list);
}
List<int[][]> list1 = new ArrayList();
int l = p_generateCustomMipmaps_0_.getFrameCount();
for (int i1 = 0; i1 < l; ++i1)
{
int[] aint2 = getFrameData(p_generateCustomMipmaps_0_, i1, 0);
if (aint2 == null || aint2.length < 1)
{
aint2 = new int[i * j];
}
if (aint2.length != i * j)
{
int k = (int)Math.round(Math.sqrt((double)aint2.length));
if (k * k != aint2.length)
{
aint2 = new int[1];
k = 1;
}
BufferedImage bufferedimage = new BufferedImage(k, k, 2);
bufferedimage.setRGB(0, 0, k, k, aint2, 0, k);
BufferedImage bufferedimage1 = scaleImage(bufferedimage, i);
int[] aint3 = new int[i * j];
bufferedimage1.getRGB(0, 0, i, j, aint3, 0, i);
aint2 = aint3;
}
int[][] aint4 = new int[p_generateCustomMipmaps_1_ + 1][];
aint4[0] = aint2;
list1.add(aint4);
}
p_generateCustomMipmaps_0_.setFramesTextureData(list1);
p_generateCustomMipmaps_0_.generateMipmaps(p_generateCustomMipmaps_1_);
}
示例4: 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();
}