本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureAtlasSprite.getIconHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureAtlasSprite.getIconHeight方法的具體用法?Java TextureAtlasSprite.getIconHeight怎麽用?Java TextureAtlasSprite.getIconHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.renderer.texture.TextureAtlasSprite
的用法示例。
在下文中一共展示了TextureAtlasSprite.getIconHeight方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: makeVertexDataSingle
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private static int[] makeVertexDataSingle(int[] p_makeVertexDataSingle_0_, TextureAtlasSprite p_makeVertexDataSingle_1_)
{
int[] aint = (int[])p_makeVertexDataSingle_0_.clone();
int i = p_makeVertexDataSingle_1_.sheetWidth / p_makeVertexDataSingle_1_.getIconWidth();
int j = p_makeVertexDataSingle_1_.sheetHeight / p_makeVertexDataSingle_1_.getIconHeight();
int k = aint.length / 4;
for (int l = 0; l < 4; ++l)
{
int i1 = l * k;
float f = Float.intBitsToFloat(aint[i1 + 4]);
float f1 = Float.intBitsToFloat(aint[i1 + 4 + 1]);
float f2 = p_makeVertexDataSingle_1_.toSingleU(f);
float f3 = p_makeVertexDataSingle_1_.toSingleV(f1);
aint[i1 + 4] = Float.floatToRawIntBits(f2);
aint[i1 + 4 + 1] = Float.floatToRawIntBits(f3);
}
return aint;
}
示例3: makeVertexDataSingle
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private static int[] makeVertexDataSingle(int[] p_makeVertexDataSingle_0_, TextureAtlasSprite p_makeVertexDataSingle_1_)
{
int[] aint = new int[p_makeVertexDataSingle_0_.length];
for (int i = 0; i < aint.length; ++i)
{
aint[i] = p_makeVertexDataSingle_0_[i];
}
int i1 = p_makeVertexDataSingle_1_.sheetWidth / p_makeVertexDataSingle_1_.getIconWidth();
int j = p_makeVertexDataSingle_1_.sheetHeight / p_makeVertexDataSingle_1_.getIconHeight();
for (int k = 0; k < 4; ++k)
{
int l = k * 7;
float f = Float.intBitsToFloat(aint[l + 4]);
float f1 = Float.intBitsToFloat(aint[l + 4 + 1]);
float f2 = p_makeVertexDataSingle_1_.toSingleU(f);
float f3 = p_makeVertexDataSingle_1_.toSingleV(f1);
aint[l + 4] = Float.floatToRawIntBits(f2);
aint[l + 4 + 1] = Float.floatToRawIntBits(f3);
}
return aint;
}
示例4: 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;
}
示例5: getInterpV
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
public static float getInterpV(float v, TextureAtlasSprite tex) {
float f = tex.getMaxV() - tex.getMinV();
return tex.getMinV() + f * (float) v / tex.getIconHeight();
}
示例6: 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_);
}
示例7: 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;
}
示例8: 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;
}
示例9: 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();
}
示例10: buildSideQuad
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private static BakedQuad buildSideQuad(VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int u, int v)
{
final float eps0 = 30e-5f;
final float eps1 = 45e-5f;
final float eps2 = .5f;
final float eps3 = .5f;
float x0 = (float)u / sprite.getIconWidth();
float y0 = (float)v / sprite.getIconHeight();
float x1 = x0, y1 = y0;
float z1 = 7.5f / 16f - eps1, z2 = 8.5f / 16f + eps1;
switch(side)
{
case WEST:
z1 = 8.5f / 16f + eps1;
z2 = 7.5f / 16f - eps1;
case EAST:
y1 = (v + 1f) / sprite.getIconHeight();
break;
case DOWN:
z1 = 8.5f / 16f + eps1;
z2 = 7.5f / 16f - eps1;
case UP:
x1 = (u + 1f) / sprite.getIconWidth();
break;
default:
throw new IllegalArgumentException("can't handle z-oriented side");
}
float u0 = 16f * (x0 - side.getDirectionVec().getX() * eps3 / sprite.getIconWidth());
float u1 = 16f * (x1 - side.getDirectionVec().getX() * eps3 / sprite.getIconWidth());
float v0 = 16f * (1f - y0 - side.getDirectionVec().getY() * eps3 / sprite.getIconHeight());
float v1 = 16f * (1f - y1 - side.getDirectionVec().getY() * eps3 / sprite.getIconHeight());
switch(side)
{
case WEST:
case EAST:
y0 -= eps1;
y1 += eps1;
v0 -= eps2 / sprite.getIconHeight();
v1 += eps2 / sprite.getIconHeight();
break;
case DOWN:
case UP:
x0 -= eps1;
x1 += eps1;
u0 += eps2 / sprite.getIconWidth();
u1 -= eps2 / sprite.getIconWidth();
break;
default:
throw new IllegalArgumentException("can't handle z-oriented side");
}
switch(side)
{
case WEST:
x0 += eps0;
x1 += eps0;
break;
case EAST:
x0 -= eps0;
x1 -= eps0;
break;
case DOWN:
y0 -= eps0;
y1 -= eps0;
break;
case UP:
y0 += eps0;
y1 += eps0;
break;
default:
throw new IllegalArgumentException("can't handle z-oriented side");
}
return buildQuad(
format, transform, side.getOpposite(), sprite, tint, // getOpposite is related either to the swapping of V direction, or something else
x0, y0, z1, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0),
x1, y1, z1, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1),
x1, y1, z2, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1),
x0, y0, z2, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0)
);
}