本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureAtlasSprite類的典型用法代碼示例。如果您正苦於以下問題:Java TextureAtlasSprite類的具體用法?Java TextureAtlasSprite怎麽用?Java TextureAtlasSprite使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TextureAtlasSprite類屬於net.minecraft.client.renderer.texture包,在下文中一共展示了TextureAtlasSprite類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private static void draw(World world, double dx, double dy, double dz, Entity entity, ScarfNode prime, ArrayList<ScarfNode> nodes) {
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/wool_colored_white");
//TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
ScarfNode lastNode = prime;
for(ScarfNode node : nodes) {
//TODO: Swap out sprites each segment?
float x1 = (float)(node.x-dx);
float x2 = (float)(lastNode.x-dx);
float y1 = (float)(node.y-dy);
float y2 = (float)(lastNode.y-dy);
float z1 = (float)(node.z-dz);
float z2 = (float)(lastNode.z-dz);
float light1 = world.getLight(new BlockPos((int)node.x, (int)node.y, (int)node.z)) / 15f;
float light2 = world.getLight(new BlockPos((int)lastNode.x, (int)lastNode.y, (int)lastNode.z)) / 15f;
ribbon(x1, y1, z1, x2, y2, z2, 0.25f, sprite, node.r, node.g, node.b, light1, light2);
ribbon(x2, y2, z2, x1, y1, z1, 0.25f, sprite, node.r, node.g, node.b, light2, light1);
lastNode = node;
}
}
示例2: drawFluidTexture
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
double uMin = textureSprite.getMinU();
double uMax = textureSprite.getMaxU();
double vMin = textureSprite.getMinV();
double vMax = textureSprite.getMaxV();
uMax = uMax - maskRight / 16.0 * (uMax - uMin);
vMax = vMax - maskTop / 16.0 * (vMax - vMin);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
worldrenderer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
worldrenderer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
worldrenderer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
tessellator.draw();
}
示例3: drawMekGasContent
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
@Optional.Method(modid = "mekanism")
private void drawMekGasContent() {
if(tank.getTank() instanceof HybridGasTank) {
GasStack gasContent = ((HybridGasTank) tank.getTank()).getGas();
if(gasContent != null && gasContent.amount > 0) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float percFilled = ((float) gasContent.amount) / ((float) tank.getTank().getCapacity());
percFilled = MathHelper.clamp(percFilled, 0F, 1F);
int pxFilled = MathHelper.ceil(percFilled * 61F);
TextureAtlasSprite tas = gasContent.getGas().getSprite();
if(tas == null) {
tas = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawTexturedModalRect(15, 10 + 61 - pxFilled, tas, 20, pxFilled);
}
}
}
示例4: getSpriteByUv
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private static TextureAtlasSprite getSpriteByUv(int[] p_getSpriteByUv_0_)
{
float f = 1.0F;
float f1 = 1.0F;
float f2 = 0.0F;
float f3 = 0.0F;
int i = p_getSpriteByUv_0_.length / 4;
for (int j = 0; j < 4; ++j)
{
int k = j * i;
float f4 = Float.intBitsToFloat(p_getSpriteByUv_0_[k + 4]);
float f5 = Float.intBitsToFloat(p_getSpriteByUv_0_[k + 4 + 1]);
f = Math.min(f, f4);
f1 = Math.min(f1, f5);
f2 = Math.max(f2, f4);
f3 = Math.max(f3, f5);
}
float f6 = (f + f2) / 2.0F;
float f7 = (f1 + f3) / 2.0F;
TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getTextureMapBlocks().getIconByUV((double)f6, (double)f7);
return textureatlassprite;
}
示例5: BakedWrapper
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
public BakedWrapper(final Node<?> node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
{
this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder()
.maximumSize(128)
.expireAfterAccess(2, TimeUnit.MINUTES)
.<Integer, B3DState>build(new CacheLoader<Integer, B3DState>()
{
public B3DState load(Integer frame) throws Exception
{
IModelState parent = state;
Animation newAnimation = node.getAnimation();
if(parent instanceof B3DState)
{
B3DState ps = (B3DState)parent;
parent = ps.getParent();
}
return new B3DState(newAnimation, frame, frame, 0, parent);
}
}));
}
示例6: 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;
}
示例7: renderObject
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
public static boolean renderObject(Minecraft mc, RenderItem itemRender, int x, int y, Object itm, boolean highlight, float lvl) {
itemRender.zLevel = lvl;
if (itm == null) {
return renderItemStack(mc, itemRender, null, x, y, "", highlight);
}
if (itm instanceof Item) {
return renderItemStack(mc, itemRender, new ItemStack((Item) itm, 1), x, y, "", highlight);
}
if (itm instanceof Block) {
return renderItemStack(mc, itemRender, new ItemStack((Block) itm, 1), x, y, "", highlight);
}
if (itm instanceof ItemStack) {
return renderItemStackWithCount(mc, itemRender, (ItemStack) itm, x, y, highlight);
}
if (itm instanceof TextureAtlasSprite) {
return renderIcon(mc, itemRender, (TextureAtlasSprite) itm, x, y, highlight);
}
return renderItemStack(mc, itemRender, ItemStack.EMPTY, x, y, "", highlight);
}
示例8: BakedItemModel
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, ItemOverrideList overrides, IBakedModel otherModel)
{
this.quads = quads;
this.particle = particle;
this.transforms = transforms;
this.overrides = overrides;
if(otherModel != null)
{
this.otherModel = otherModel;
this.isCulled = true;
}
else
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(BakedQuad quad : quads)
{
if(quad.getFace() == EnumFacing.SOUTH)
{
builder.add(quad);
}
}
this.otherModel = new BakedItemModel(builder.build(), particle, transforms, overrides, this);
isCulled = false;
}
}
示例9: setVertexState
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
public void setVertexState(WorldRenderer.State state)
{
this.rawIntBuffer.clear();
this.func_181670_b(state.getRawBuffer().length);
this.rawIntBuffer.put(state.getRawBuffer());
this.vertexCount = state.getVertexCount();
this.vertexFormat = new VertexFormat(state.getVertexFormat());
if (state.stateQuadSprites != null)
{
if (this.quadSprites == null)
{
this.quadSprites = new TextureAtlasSprite[this.getBufferQuadSize()];
}
TextureAtlasSprite[] atextureatlassprite = state.stateQuadSprites;
System.arraycopy(atextureatlassprite, 0, this.quadSprites, 0, atextureatlassprite.length);
}
else
{
this.quadSprites = null;
}
}
示例10: getConnectedTextureMultiPass
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private static TextureAtlasSprite getConnectedTextureMultiPass(IBlockAccess p_getConnectedTextureMultiPass_0_, IBlockState p_getConnectedTextureMultiPass_1_, BlockPos p_getConnectedTextureMultiPass_2_, EnumFacing p_getConnectedTextureMultiPass_3_, TextureAtlasSprite p_getConnectedTextureMultiPass_4_, RenderEnv p_getConnectedTextureMultiPass_5_)
{
TextureAtlasSprite textureatlassprite = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, p_getConnectedTextureMultiPass_4_, true, p_getConnectedTextureMultiPass_5_);
if (!multipass)
{
return textureatlassprite;
}
else if (textureatlassprite == p_getConnectedTextureMultiPass_4_)
{
return textureatlassprite;
}
else
{
TextureAtlasSprite textureatlassprite1 = textureatlassprite;
for (int i = 0; i < 3; ++i)
{
TextureAtlasSprite textureatlassprite2 = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, textureatlassprite1, false, p_getConnectedTextureMultiPass_5_);
if (textureatlassprite2 == textureatlassprite1)
{
break;
}
textureatlassprite1 = textureatlassprite2;
}
return textureatlassprite1;
}
}
示例11: makeQuadVertexData
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
{
int[] aint = new int[28];
for (int i = 0; i < 4; ++i)
{
this.fillVertexData(aint, i, facing, partFace, p_178405_4_, sprite, modelRotationIn, partRotation, uvLocked, shade);
}
return aint;
}
示例12: ParticleGlowBase
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
protected ParticleGlowBase(World world, double x, double y, double z,
double velocityX, double velocityY, double velocityZ)
{
super(world, x, y, z, velocityX, velocityY, velocityZ);
this.particleAlpha = 0.90F;
motionX = velocityX;
motionY = velocityY;
motionZ = velocityZ;
particleRainbow = rand.nextInt(32);
this.particleMaxAge = 20;
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
setParticleTexture(sprite);
}
示例13: BakedProgrammingPuzzle
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
public BakedProgrammingPuzzle(ModelProgrammingPuzzle parent, ImmutableList<BakedQuad> quads,
TextureAtlasSprite particle, VertexFormat format,
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
Map<String, IBakedModel> cache) {
this.quads = quads;
this.particle = particle;
this.format = format;
this.parent = parent;
this.transforms = transforms;
this.cache = cache;
this.overridesList = new PuzzleOverrideList(Collections.emptyList(), this);
}
示例14: makeItemModels
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private void makeItemModels()
{
for (ResourceLocation resourcelocation : this.itemLocations.values())
{
ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);
if (this.hasItemModel(modelblock))
{
ModelBlock modelblock1 = this.makeItemModel(modelblock);
if (modelblock1 != null)
{
modelblock1.name = resourcelocation.toString();
}
this.models.put(resourcelocation, modelblock1);
}
else if (this.isCustomRenderer(modelblock))
{
this.models.put(resourcelocation, modelblock);
}
}
for (TextureAtlasSprite textureatlassprite : this.sprites.values())
{
if (!textureatlassprite.hasAnimationMetadata())
{
textureatlassprite.clearFramesTextureData();
}
}
}
示例15: func_178394_a
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入依賴的package包/類
private List<BlockPart> func_178394_a(int p_178394_1_, String p_178394_2_, TextureAtlasSprite p_178394_3_)
{
Map<EnumFacing, BlockPartFace> map = Maps.<EnumFacing, BlockPartFace>newHashMap();
map.put(EnumFacing.SOUTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {0.0F, 0.0F, 16.0F, 16.0F}, 0)));
map.put(EnumFacing.NORTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {16.0F, 0.0F, 0.0F, 16.0F}, 0)));
List<BlockPart> list = Lists.<BlockPart>newArrayList();
list.add(new BlockPart(new Vector3f(0.0F, 0.0F, 7.5F), new Vector3f(16.0F, 16.0F, 8.5F), map, (BlockPartRotation)null, true));
list.addAll(this.func_178397_a(p_178394_3_, p_178394_2_, p_178394_1_));
return list;
}