本文整理汇总了Java中net.minecraft.client.renderer.texture.TextureAtlasSprite.getMinV方法的典型用法代码示例。如果您正苦于以下问题:Java TextureAtlasSprite.getMinV方法的具体用法?Java TextureAtlasSprite.getMinV怎么用?Java TextureAtlasSprite.getMinV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.texture.TextureAtlasSprite
的用法示例。
在下文中一共展示了TextureAtlasSprite.getMinV方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isFullSprite
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
private boolean isFullSprite(BakedQuad p_isFullSprite_1_)
{
TextureAtlasSprite textureatlassprite = p_isFullSprite_1_.getSprite();
float f = textureatlassprite.getMinU();
float f1 = textureatlassprite.getMaxU();
float f2 = f1 - f;
float f3 = f2 / 256.0F;
float f4 = textureatlassprite.getMinV();
float f5 = textureatlassprite.getMaxV();
float f6 = f5 - f4;
float f7 = f6 / 256.0F;
int[] aint = p_isFullSprite_1_.getVertexData();
int i = aint.length / 4;
for (int j = 0; j < 4; ++j)
{
int k = j * i;
float f8 = Float.intBitsToFloat(aint[k + 4]);
float f9 = Float.intBitsToFloat(aint[k + 4 + 1]);
if (!this.equalsDelta(f8, f, f3) && !this.equalsDelta(f8, f1, f3))
{
return false;
}
if (!this.equalsDelta(f9, f4, f7) && !this.equalsDelta(f9, f5, f7))
{
return false;
}
}
return true;
}
示例2: doRender
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doe
*/
public void doRender(EntityFireball entity, double x, double y, double z, float entityYaw, float partialTicks)
{
GlStateManager.pushMatrix();
this.bindEntityTexture(entity);
GlStateManager.translate((float)x, (float)y, (float)z);
GlStateManager.enableRescaleNormal();
GlStateManager.scale(this.scale, this.scale, this.scale);
TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(Items.fire_charge);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
float f = textureatlassprite.getMinU();
float f1 = textureatlassprite.getMaxU();
float f2 = textureatlassprite.getMinV();
float f3 = textureatlassprite.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
worldrenderer.pos(-0.5D, -0.25D, 0.0D).tex((double)f, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(0.5D, -0.25D, 0.0D).tex((double)f1, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(0.5D, 0.75D, 0.0D).tex((double)f1, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(-0.5D, 0.75D, 0.0D).tex((double)f, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex();
tessellator.draw();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
示例3: renderBlockInHand
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Render the block in the player's hand
*/
private void renderBlockInHand(float partialTicks, TextureAtlasSprite atlas)
{
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
float f = 0.1F;
GlStateManager.color(0.1F, 0.1F, 0.1F, 0.5F);
GlStateManager.pushMatrix();
float f1 = -1.0F;
float f2 = 1.0F;
float f3 = -1.0F;
float f4 = 1.0F;
float f5 = -0.5F;
float f6 = atlas.getMinU();
float f7 = atlas.getMaxU();
float f8 = atlas.getMinV();
float f9 = atlas.getMaxV();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos(-1.0D, -1.0D, -0.5D).tex((double)f7, (double)f9).endVertex();
vertexbuffer.pos(1.0D, -1.0D, -0.5D).tex((double)f6, (double)f9).endVertex();
vertexbuffer.pos(1.0D, 1.0D, -0.5D).tex((double)f6, (double)f8).endVertex();
vertexbuffer.pos(-1.0D, 1.0D, -0.5D).tex((double)f7, (double)f8).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
示例4: func_180474_b
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
private void func_180474_b(float p_180474_1_, ScaledResolution p_180474_2_)
{
if (p_180474_1_ < 1.0F)
{
p_180474_1_ = p_180474_1_ * p_180474_1_;
p_180474_1_ = p_180474_1_ * p_180474_1_;
p_180474_1_ = p_180474_1_ * 0.8F + 0.2F;
}
GlStateManager.disableAlpha();
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(1.0F, 1.0F, 1.0F, p_180474_1_);
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.portal.getDefaultState());
float f = textureatlassprite.getMinU();
float f1 = textureatlassprite.getMinV();
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMaxV();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(0.0D, (double)p_180474_2_.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex();
worldrenderer.pos((double)p_180474_2_.getScaledWidth(), (double)p_180474_2_.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex();
worldrenderer.pos((double)p_180474_2_.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex();
worldrenderer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex();
tessellator.draw();
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
示例5: renderPortal
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
protected void renderPortal(float timeInPortal, ScaledResolution scaledRes)
{
if (timeInPortal < 1.0F)
{
timeInPortal = timeInPortal * timeInPortal;
timeInPortal = timeInPortal * timeInPortal;
timeInPortal = timeInPortal * 0.8F + 0.2F;
}
GlStateManager.disableAlpha();
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.color(1.0F, 1.0F, 1.0F, timeInPortal);
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.PORTAL.getDefaultState());
float f = textureatlassprite.getMinU();
float f1 = textureatlassprite.getMinV();
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMaxV();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex();
vertexbuffer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex();
vertexbuffer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex();
vertexbuffer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex();
tessellator.draw();
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
示例6: putTiledTextureQuads
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/** Adds a quad to the rendering pipeline. Call startDrawingQuads beforehand. You need to call draw() yourself. */
static void putTiledTextureQuads(BufferBuilder renderer, int x, int y, int width, int height, float depth, TextureAtlasSprite sprite) {
float u1 = sprite.getMinU();
float v1 = sprite.getMinV();
// tile vertically
do {
int renderHeight = Math.min(sprite.getIconHeight(), height);
height -= renderHeight;
float v2 = sprite.getInterpolatedV((16f * renderHeight) / (float) sprite.getIconHeight());
// we need to draw the quads per width too
int x2 = x;
int width2 = width;
// tile horizontally
do {
int renderWidth = Math.min(sprite.getIconWidth(), width2);
width2 -= renderWidth;
float u2 = sprite.getInterpolatedU((16f * renderWidth) / (float) sprite.getIconWidth());
renderer.pos(x2, y, depth).tex(u1, v1).endVertex();
renderer.pos(x2, y + renderHeight, depth).tex(u1, v2).endVertex();
renderer.pos(x2 + renderWidth, y + renderHeight, depth).tex(u2, v2).endVertex();
renderer.pos(x2 + renderWidth, y, depth).tex(u2, v1).endVertex();
x2 += renderWidth;
} while(width2 > 0);
y += renderHeight;
} while(height > 0);
}
示例7: func_180474_b
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
private void func_180474_b(float p_180474_1_, ScaledResolution p_180474_2_) {
if (p_180474_1_ < 1.0F) {
p_180474_1_ = p_180474_1_ * p_180474_1_;
p_180474_1_ = p_180474_1_ * p_180474_1_;
p_180474_1_ = p_180474_1_ * 0.8F + 0.2F;
}
GlStateManager.disableAlpha();
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(1.0F, 1.0F, 1.0F, p_180474_1_);
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes()
.getTexture(Blocks.portal.getDefaultState());
float f = textureatlassprite.getMinU();
float f1 = textureatlassprite.getMinV();
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMaxV();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(0.0D, (double) p_180474_2_.getScaledHeight(), -90.0D).tex((double) f, (double) f3)
.endVertex();
worldrenderer.pos((double) p_180474_2_.getScaledWidth(), (double) p_180474_2_.getScaledHeight(), -90.0D)
.tex((double) f2, (double) f3).endVertex();
worldrenderer.pos((double) p_180474_2_.getScaledWidth(), 0.0D, -90.0D).tex((double) f2, (double) f1)
.endVertex();
worldrenderer.pos(0.0D, 0.0D, -90.0D).tex((double) f, (double) f1).endVertex();
tessellator.draw();
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
示例8: doRender
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityFireball entity, double x, double y, double z, float entityYaw, float partialTicks)
{
GlStateManager.pushMatrix();
this.bindEntityTexture(entity);
GlStateManager.translate((float)x, (float)y, (float)z);
GlStateManager.enableRescaleNormal();
GlStateManager.scale(this.scale, this.scale, this.scale);
TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(Items.FIRE_CHARGE);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
float f = textureatlassprite.getMinU();
float f1 = textureatlassprite.getMaxU();
float f2 = textureatlassprite.getMinV();
float f3 = textureatlassprite.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((float)(this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * -this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
if (this.renderOutlines)
{
GlStateManager.enableColorMaterial();
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
}
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
vertexbuffer.pos(-0.5D, -0.25D, 0.0D).tex((double)f, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(0.5D, -0.25D, 0.0D).tex((double)f1, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(0.5D, 0.75D, 0.0D).tex((double)f1, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(-0.5D, 0.75D, 0.0D).tex((double)f, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex();
tessellator.draw();
if (this.renderOutlines)
{
GlStateManager.disableOutlineMode();
GlStateManager.disableColorMaterial();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
示例9: renderFireInFirstPerson
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Renders the fire on the screen for first person mode. Arg: partialTickTime
*/
private void renderFireInFirstPerson(float partialTicks)
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F);
GlStateManager.depthFunc(519);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
float f = 1.0F;
for (int i = 0; i < 2; ++i)
{
GlStateManager.pushMatrix();
TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_1");
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float f1 = textureatlassprite.getMinU();
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMinV();
float f4 = textureatlassprite.getMaxV();
float f5 = -0.5F;
float f6 = 0.5F;
float f7 = -0.5F;
float f8 = 0.5F;
float f9 = -0.5F;
GlStateManager.translate((float)(-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F);
GlStateManager.rotate((float)(i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F);
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos(-0.5D, -0.5D, -0.5D).tex((double)f2, (double)f4).endVertex();
vertexbuffer.pos(0.5D, -0.5D, -0.5D).tex((double)f1, (double)f4).endVertex();
vertexbuffer.pos(0.5D, 0.5D, -0.5D).tex((double)f1, (double)f3).endVertex();
vertexbuffer.pos(-0.5D, 0.5D, -0.5D).tex((double)f2, (double)f3).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.depthFunc(515);
}
示例10: renderEntityOnFire
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime
*/
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks)
{
GlStateManager.disableLighting();
TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0");
TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1");
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y, (float)z);
float f = entity.width * 1.4F;
GlStateManager.scale(f, f, f);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
float f1 = 0.5F;
float f2 = 0.0F;
float f3 = entity.height / f;
float f4 = (float)(entity.posY - entity.getEntityBoundingBox().minY);
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float f5 = 0.0F;
int i = 0;
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
while (f3 > 0.0F)
{
TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1;
this.bindTexture(TextureMap.locationBlocksTexture);
float f6 = textureatlassprite2.getMinU();
float f7 = textureatlassprite2.getMinV();
float f8 = textureatlassprite2.getMaxU();
float f9 = textureatlassprite2.getMaxV();
if (i / 2 % 2 == 0)
{
float f10 = f8;
f8 = f6;
f6 = f10;
}
worldrenderer.pos((double)(f1 - f2), (double)(0.0F - f4), (double)f5).tex((double)f8, (double)f9).endVertex();
worldrenderer.pos((double)(-f1 - f2), (double)(0.0F - f4), (double)f5).tex((double)f6, (double)f9).endVertex();
worldrenderer.pos((double)(-f1 - f2), (double)(1.4F - f4), (double)f5).tex((double)f6, (double)f7).endVertex();
worldrenderer.pos((double)(f1 - f2), (double)(1.4F - f4), (double)f5).tex((double)f8, (double)f7).endVertex();
f3 -= 0.45F;
f4 -= 0.45F;
f1 *= 0.9F;
f5 += 0.03F;
++i;
}
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.enableLighting();
}
示例11: 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();
}
示例12: renderFireInFirstPerson
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Renders the fire on the screen for first person mode. Arg: partialTickTime
*/
private void renderFireInFirstPerson(float p_78442_1_)
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F);
GlStateManager.depthFunc(519);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
float f = 1.0F;
for (int i = 0; i < 2; ++i)
{
GlStateManager.pushMatrix();
TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_1");
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
float f1 = textureatlassprite.getMinU();
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMinV();
float f4 = textureatlassprite.getMaxV();
float f5 = (0.0F - f) / 2.0F;
float f6 = f5 + f;
float f7 = 0.0F - f / 2.0F;
float f8 = f7 + f;
float f9 = -0.5F;
GlStateManager.translate((float)(-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F);
GlStateManager.rotate((float)(i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)f5, (double)f7, (double)f9).tex((double)f2, (double)f4).endVertex();
worldrenderer.pos((double)f6, (double)f7, (double)f9).tex((double)f1, (double)f4).endVertex();
worldrenderer.pos((double)f6, (double)f8, (double)f9).tex((double)f1, (double)f3).endVertex();
worldrenderer.pos((double)f5, (double)f8, (double)f9).tex((double)f2, (double)f3).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.depthFunc(515);
}
示例13: renderEntityOnFire
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
/**
* Renders a layer of fire on top of an entity.
*/
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks)
{
GlStateManager.disableLighting();
TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0");
TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1");
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y, (float)z);
float f = entity.width * 1.4F;
GlStateManager.scale(f, f, f);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
float f1 = 0.5F;
float f2 = 0.0F;
float f3 = entity.height / f;
float f4 = (float)(entity.posY - entity.getEntityBoundingBox().minY);
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float f5 = 0.0F;
int i = 0;
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
while (f3 > 0.0F)
{
TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1;
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float f6 = textureatlassprite2.getMinU();
float f7 = textureatlassprite2.getMinV();
float f8 = textureatlassprite2.getMaxU();
float f9 = textureatlassprite2.getMaxV();
if (i / 2 % 2 == 0)
{
float f10 = f8;
f8 = f6;
f6 = f10;
}
vertexbuffer.pos((double)(f1 - 0.0F), (double)(0.0F - f4), (double)f5).tex((double)f8, (double)f9).endVertex();
vertexbuffer.pos((double)(-f1 - 0.0F), (double)(0.0F - f4), (double)f5).tex((double)f6, (double)f9).endVertex();
vertexbuffer.pos((double)(-f1 - 0.0F), (double)(1.4F - f4), (double)f5).tex((double)f6, (double)f7).endVertex();
vertexbuffer.pos((double)(f1 - 0.0F), (double)(1.4F - f4), (double)f5).tex((double)f8, (double)f7).endVertex();
f3 -= 0.45F;
f4 -= 0.45F;
f1 *= 0.9F;
f5 += 0.03F;
++i;
}
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.enableLighting();
}
示例14: renderGuiFluid
import net.minecraft.client.renderer.texture.TextureAtlasSprite; //导入方法依赖的package包/类
public static void renderGuiFluid(FluidStack fluid, float fill, int x, int y, int width, int maxHeight)
{
if (fluid != null && fluid.getFluid() != null && fluid.amount > 0)
{
TextureAtlasSprite sprite = getStillTexture(fluid);
if (sprite != null)
{
int rendHeight = (int) Math.max(Math.min((float) maxHeight, (float) maxHeight * fill), 1.0F);
int yPos = y + maxHeight - rendHeight;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
int fluidColor = fluid.getFluid().getColor(fluid);
GL11.glColor3ub((byte) (fluidColor >> 16 & 255), (byte) (fluidColor >> 8 & 255), (byte) (fluidColor & 255));
GlStateManager.enableBlend();
for (int i = 0; i < width; i += 16)
{
for (int j = 0; j < rendHeight; j += 16)
{
int dwt = Math.min(width - i, 16);
int dht = Math.min(rendHeight - j, 16);
int dx = x + i;
int dy = yPos + j;
double minU = (double) sprite.getMinU();
double maxU = (double) sprite.getMaxU();
double minV = (double) sprite.getMinV();
double maxV = (double) sprite.getMaxV();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder tes = tessellator.getBuffer();
tes.begin(7, DefaultVertexFormats.POSITION_TEX);
tes.pos((double) dx, (double) (dy + dht), 0.0D).tex(minU, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
tes.pos((double) (dx + dwt), (double) (dy + dht), 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
tes.pos((double) (dx + dwt), (double) dy, 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV).endVertex();
tes.pos((double) dx, (double) dy, 0.0D).tex(minU, minV).endVertex();
tessellator.draw();
}
}
GlStateManager.disableBlend();
}
}
}