本文整理汇总了Java中net.minecraft.client.renderer.Tessellator.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Tessellator.getInstance方法的具体用法?Java Tessellator.getInstance怎么用?Java Tessellator.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.Tessellator
的用法示例。
在下文中一共展示了Tessellator.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_178051_a
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
private void func_178051_a(int p_178051_1_, int p_178051_2_, ResourceLocation p_178051_3_)
{
int i = p_178051_1_ + 5;
GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ - 1, -2039584);
GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ + 32, -6250336);
GuiScreenCustomizePresets.this.drawVerticalLine(i - 1, p_178051_2_ - 1, p_178051_2_ + 32, -2039584);
GuiScreenCustomizePresets.this.drawVerticalLine(i + 32, p_178051_2_ - 1, p_178051_2_ + 32, -6250336);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(p_178051_3_);
int j = 32;
int k = 32;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)(i + 0), (double)(p_178051_2_ + 32), 0.0D).tex(0.0D, 1.0D).endVertex();
worldrenderer.pos((double)(i + 32), (double)(p_178051_2_ + 32), 0.0D).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos((double)(i + 32), (double)(p_178051_2_ + 0), 0.0D).tex(1.0D, 0.0D).endVertex();
worldrenderer.pos((double)(i + 0), (double)(p_178051_2_ + 0), 0.0D).tex(0.0D, 0.0D).endVertex();
tessellator.draw();
}
示例2: drawItemBackground
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
* Draws the background icon for an item, using a texture from stats.png with the given coords
*/
private void drawItemBackground(int x, int z, int textureX, int textureY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Gui.STAT_ICONS);
float f = 0.0078125F;
float f1 = 0.0078125F;
int i = 18;
int j = 18;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(x + 0), (double)(z + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 0) * 0.0078125F), (double)((float)(textureY + 18) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(x + 18), (double)(z + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 18) * 0.0078125F), (double)((float)(textureY + 18) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(x + 18), (double)(z + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 18) * 0.0078125F), (double)((float)(textureY + 0) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(x + 0), (double)(z + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 0) * 0.0078125F), (double)((float)(textureY + 0) * 0.0078125F)).endVertex();
tessellator.draw();
}
示例3: renderLitParticles
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public void renderLitParticles(Entity entityIn, float p_78872_2_)
{
float f = 0.017453292F;
float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);
for (int i = 0; i < 2; ++i)
{
List list = this.fxLayers[3][i];
if (!list.isEmpty())
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
for (int j = 0; j < list.size(); ++j)
{
EntityFX entityfx = (EntityFX)list.get(j);
entityfx.renderParticle(worldrenderer, entityIn, p_78872_2_, f1, f5, f2, f3, f4);
}
}
}
}
示例4: renderChunkBoundary
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
private void renderChunkBoundary(int xChunk, int zChunk, double xBase, double zBase) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
Chunk chunk = this.mc.world.getChunkFromChunkCoords(xChunk, zChunk);
for (LineStyle line : this.style.getLines()) {
if (line.prepare(this.style.getRenderType())) {
buf.begin(GL_LINES, DefaultVertexFormats.POSITION);
line.applyColour();
int[][] lastHeight = { { -1, -1 }, { -1, -1 } };
for (int i = 0, height = 0; i < 16; i++) {
for (int j = 0; j < 2; j++) {
for (int axis = 0; axis < 2; axis++) {
height = axis == 0 ? chunk.getHeightValue(j * 15, i) : chunk.getHeightValue(i, j * 15);
double xPos = axis == 0 ? xBase + (j * 16) : xBase + i;
double zPos = axis == 0 ? zBase - 16 + i : zBase - 16 + (j * 16);
if (lastHeight[axis][j] > -1 && height != lastHeight[axis][j]) {
buf.pos(xPos, lastHeight[axis][j], zPos).endVertex();
buf.pos(xPos, height, zPos).endVertex();
}
buf.pos(xPos, height, zPos).endVertex();
buf.pos(xPos + axis, height, zPos + (1 - axis)).endVertex();
lastHeight[axis][j] = height;
}
}
}
tessellator.draw();
}
}
}
示例5: drawCursorVertical
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
* draws the vertical line cursor in the textbox
*/
private void drawCursorVertical(int p_146188_1_, int p_146188_2_, int p_146188_3_, int p_146188_4_) {
if (p_146188_1_ < p_146188_3_) {
int i = p_146188_1_;
p_146188_1_ = p_146188_3_;
p_146188_3_ = i;
}
if (p_146188_2_ < p_146188_4_) {
int j = p_146188_2_;
p_146188_2_ = p_146188_4_;
p_146188_4_ = j;
}
if (p_146188_3_ > this.xPosition + this.width) {
p_146188_3_ = this.xPosition + this.width;
}
if (p_146188_1_ > this.xPosition + this.width) {
p_146188_1_ = this.xPosition + this.width;
}
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F);
GlStateManager.disableTexture2D();
GlStateManager.enableColorLogic();
GlStateManager.colorLogicOp(5387);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos((double) p_146188_1_, (double) p_146188_4_, 0.0D).endVertex();
worldrenderer.pos((double) p_146188_3_, (double) p_146188_4_, 0.0D).endVertex();
worldrenderer.pos((double) p_146188_3_, (double) p_146188_2_, 0.0D).endVertex();
worldrenderer.pos((double) p_146188_1_, (double) p_146188_2_, 0.0D).endVertex();
tessellator.draw();
GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D();
}
示例6: drawTexturedModalRect
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(x + 0), (double)(y + height), (double)0).tex((double)((float)(textureX + 0) * 0.00390625F), (double)((float)(textureY + height) * 0.00390625F)).endVertex();
vertexbuffer.pos((double)(x + width), (double)(y + height), (double)0).tex((double)((float)(textureX + width) * 0.00390625F), (double)((float)(textureY + height) * 0.00390625F)).endVertex();
vertexbuffer.pos((double)(x + width), (double)(y + 0), (double)0).tex((double)((float)(textureX + width) * 0.00390625F), (double)((float)(textureY + 0) * 0.00390625F)).endVertex();
vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)0).tex((double)((float)(textureX + 0) * 0.00390625F), (double)((float)(textureY + 0) * 0.00390625F)).endVertex();
tessellator.draw();
}
示例7: drawReloadButtons
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public void drawReloadButtons()
{
disableListWhenSyncTrack = true;
if(!bandName.getText().isEmpty())
{
disableListWhenSyncTrack = Clef.eventHandlerClient.findTrackByBand(bandName.getText()) != null;
}
fontRenderer.drawString(I18n.translateToLocal("clef.gui.reload"), guiLeft + 179, guiTop + 126, 16777215, true);
if(doneTimeout > 0)
{
fontRenderer.drawString(I18n.translateToLocal("gui.done"), guiLeft + 179 + 2 + fontRenderer.getStringWidth(I18n.translateToLocal("clef.gui.reload")), guiTop + 126, 16777215, true);
}
GlStateManager.color(1F, 1F, 1F, 1F);
this.mc.getTextureManager().bindTexture(texInstrument);
float x = guiLeft + 179 + 2;
float y = guiTop + 137 + 2;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
bufferbuilder.pos((double)(x + 0), (double)(y + 16), (double)this.zLevel).tex(0F, 1F).endVertex();
bufferbuilder.pos((double)(x + 16), (double)(y + 16), (double)this.zLevel).tex(1F, 1F).endVertex();
bufferbuilder.pos((double)(x + 16), (double)(y + 0), (double)this.zLevel).tex(1F, 0F).endVertex();
bufferbuilder.pos((double)(x + 0), (double)(y + 0), (double)this.zLevel).tex(0F, 0F).endVertex();
tessellator.draw();
this.mc.getTextureManager().bindTexture(texIcons);
this.drawTexturedModalRect(guiLeft + 236, guiTop + 142, 0, 224, 10, 10);
GlStateManager.color(0.5F, 1F, 1F, 1F);
this.mc.getTextureManager().bindTexture(texNote);
this.drawTexturedModalRect(guiLeft + 205 + 2, guiTop + 137 + 2, 0, 64, 16, 16);
}
示例8: render
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void render() {
Minecraft.getMinecraft().getTextureManager().bindTexture(location);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().getTextureManager().getTexture(location).getGlTextureId());
final Tessellator t = Tessellator.getInstance();
final VertexBuffer r = t.getBuffer();
r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
r.pos(0, 16, 0).tex(0, 1).endVertex();
r.pos(16, 16, 0).tex(1, 1).endVertex();
r.pos(16, 0, 0).tex(1, 0).endVertex();
r.pos(0, 0, 0).tex(0, 0).endVertex();
t.draw();
}
示例9: drawTexturedModalRect
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
* Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height
*/
public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)(x + 0), (double)(y + height), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
worldrenderer.pos((double)(x + 0), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
tessellator.draw();
}
示例10: drawWinGameScreen
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
private void drawWinGameScreen(int p_146575_1_, int p_146575_2_, float p_146575_3_)
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
int i = this.width;
float f = 0.0F - ((float)this.time + p_146575_3_) * 0.5F * 0.5F;
float f1 = (float)this.height - ((float)this.time + p_146575_3_) * 0.5F * 0.5F;
float f2 = 0.015625F;
float f3 = ((float)this.time + p_146575_3_ - 0.0F) * 0.02F;
float f4 = (float)(this.totalScrollLength + this.height + this.height + 24) / 0.5F;
float f5 = (f4 - 20.0F - ((float)this.time + p_146575_3_)) * 0.005F;
if (f5 < f3)
{
f3 = f5;
}
if (f3 > 1.0F)
{
f3 = 1.0F;
}
f3 = f3 * f3;
f3 = f3 * 96.0F / 255.0F;
vertexbuffer.pos(0.0D, (double)this.height, (double)this.zLevel).tex(0.0D, (double)(f * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
vertexbuffer.pos((double)i, (double)this.height, (double)this.zLevel).tex((double)((float)i * 0.015625F), (double)(f * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
vertexbuffer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)((float)i * 0.015625F), (double)(f1 * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
vertexbuffer.pos(0.0D, 0.0D, (double)this.zLevel).tex(0.0D, (double)(f1 * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
tessellator.draw();
}
示例11: doRenderLayer
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public void doRenderLayer(EntityDragon entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
if (entitylivingbaseIn.deathTicks > 0)
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
RenderHelper.disableStandardItemLighting();
float f = ((float)entitylivingbaseIn.deathTicks + partialTicks) / 200.0F;
float f1 = 0.0F;
if (f > 0.8F)
{
f1 = (f - 0.8F) / 0.2F;
}
Random random = new Random(432L);
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(7425);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
GlStateManager.disableAlpha();
GlStateManager.enableCull();
GlStateManager.depthMask(false);
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -1.0F, -2.0F);
for (int i = 0; (float)i < (f + f * f) / 2.0F * 60.0F; ++i)
{
GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(random.nextFloat() * 360.0F + f * 90.0F, 0.0F, 0.0F, 1.0F);
float f2 = random.nextFloat() * 20.0F + 5.0F + f1 * 10.0F;
float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F;
vertexbuffer.begin(6, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(255, 255, 255, (int)(255.0F * (1.0F - f1))).endVertex();
vertexbuffer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex();
vertexbuffer.pos(0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex();
vertexbuffer.pos(0.0D, (double)f2, (double)(1.0F * f3)).color(255, 0, 255, 0).endVertex();
vertexbuffer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex();
tessellator.draw();
}
GlStateManager.popMatrix();
GlStateManager.depthMask(true);
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.shadeModel(7424);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
RenderHelper.enableStandardItemLighting();
}
}
示例12: doRender
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
if (entity.getBlock() != null)
{
IBlockState iblockstate = entity.getBlock();
if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL)
{
World world = entity.getWorldObj();
if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
if (this.renderOutlines)
{
GlStateManager.enableColorMaterial();
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
}
vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY()), (float)(z - (double)blockpos.getZ() - 0.5D));
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, vertexbuffer, false, MathHelper.getPositionRandom(entity.getOrigin()));
tessellator.draw();
if (this.renderOutlines)
{
GlStateManager.disableOutlineMode();
GlStateManager.disableColorMaterial();
}
GlStateManager.enableLighting();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
}
}
}
示例13: drawRechargeRay
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
* Draws the ray from the dragon to it's crystal
*/
protected void drawRechargeRay(EntityDragon dragon, double p_180574_2_, double p_180574_4_, double p_180574_6_, float p_180574_8_)
{
float f = (float)dragon.healingEnderCrystal.innerRotation + p_180574_8_;
float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F;
f1 = (f1 * f1 + f1) * 0.2F;
float f2 = (float)(dragon.healingEnderCrystal.posX - dragon.posX - (dragon.prevPosX - dragon.posX) * (double)(1.0F - p_180574_8_));
float f3 = (float)((double)f1 + dragon.healingEnderCrystal.posY - 1.0D - dragon.posY - (dragon.prevPosY - dragon.posY) * (double)(1.0F - p_180574_8_));
float f4 = (float)(dragon.healingEnderCrystal.posZ - dragon.posZ - (dragon.prevPosZ - dragon.posZ) * (double)(1.0F - p_180574_8_));
float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4);
float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4);
GlStateManager.pushMatrix();
GlStateManager.translate((float)p_180574_2_, (float)p_180574_4_ + 2.0F, (float)p_180574_6_);
GlStateManager.rotate((float)(-Math.atan2((double)f4, (double)f2)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((float)(-Math.atan2((double)f5, (double)f3)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableCull();
this.bindTexture(enderDragonCrystalBeamTextures);
GlStateManager.shadeModel(7425);
float f7 = 0.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F;
float f8 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F;
worldrenderer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR);
int i = 8;
for (int j = 0; j <= 8; ++j)
{
float f9 = MathHelper.sin((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F;
float f10 = MathHelper.cos((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F;
float f11 = (float)(j % 8) * 1.0F / 8.0F;
worldrenderer.pos((double)(f9 * 0.2F), (double)(f10 * 0.2F), 0.0D).tex((double)f11, (double)f8).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)f9, (double)f10, (double)f6).tex((double)f11, (double)f7).color(255, 255, 255, 255).endVertex();
}
tessellator.draw();
GlStateManager.enableCull();
GlStateManager.shadeModel(7424);
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}
示例14: renderLivingLabel
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
* Renders an entity's name above its head
*/
protected void renderLivingLabel(Entity entityIn, String str, double x, double y, double z, int maxDistance)
{
if (entityIn instanceof EntityPlayer)
{
NametagRenderEvent event = new NametagRenderEvent(entityIn, str, x, y, z);
event.call();
if (event.isCancelled()) return;
}
double d0 = entityIn.getDistanceSqToEntity(this.renderManager.livingPlayer);
if (d0 <= (double)(maxDistance * maxDistance))
{
FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
float f = 1.6F;
float f1 = 0.016666668F * f;
GlStateManager.pushMatrix();
GlStateManager.translate((float)x + 0.0F, (float)y + entityIn.height + 0.5F, (float)z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(-f1, -f1, f1);
GlStateManager.disableLighting();
GlStateManager.depthMask(false);
GlStateManager.disableDepth();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
byte b0 = 0;
if (str.equals("deadmau5"))
{
b0 = -10;
}
int i = fontrenderer.getStringWidth(str) / 2;
GlStateManager.disableTexture2D();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos((double)(-i - 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos((double)(-i - 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos((double)(i + 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos((double)(i + 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, 553648127);
GlStateManager.enableDepth();
GlStateManager.depthMask(true);
fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, -1);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
}
}
示例15: renderPainting
import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
private void renderPainting(EntityPainting painting, int width, int height, int textureU, int textureV)
{
float f = (float)(-width) / 2.0F;
float f1 = (float)(-height) / 2.0F;
float f2 = 0.5F;
float f3 = 0.75F;
float f4 = 0.8125F;
float f5 = 0.0F;
float f6 = 0.0625F;
float f7 = 0.75F;
float f8 = 0.8125F;
float f9 = 0.001953125F;
float f10 = 0.001953125F;
float f11 = 0.7519531F;
float f12 = 0.7519531F;
float f13 = 0.0F;
float f14 = 0.0625F;
for (int i = 0; i < width / 16; ++i)
{
for (int j = 0; j < height / 16; ++j)
{
float f15 = f + (float)((i + 1) * 16);
float f16 = f + (float)(i * 16);
float f17 = f1 + (float)((j + 1) * 16);
float f18 = f1 + (float)(j * 16);
this.setLightmap(painting, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
float f19 = (float)(textureU + width - i * 16) / 256.0F;
float f20 = (float)(textureU + width - (i + 1) * 16) / 256.0F;
float f21 = (float)(textureV + height - j * 16) / 256.0F;
float f22 = (float)(textureV + height - (j + 1) * 16) / 256.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
worldrenderer.pos((double)f15, (double)f18, (double)(-f2)).tex((double)f20, (double)f21).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)f16, (double)f18, (double)(-f2)).tex((double)f19, (double)f21).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)f16, (double)f17, (double)(-f2)).tex((double)f19, (double)f22).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)f15, (double)f17, (double)(-f2)).tex((double)f20, (double)f22).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)f15, (double)f17, (double)f2).tex((double)f3, (double)f5).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)f16, (double)f17, (double)f2).tex((double)f4, (double)f5).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)f16, (double)f18, (double)f2).tex((double)f4, (double)f6).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)f15, (double)f18, (double)f2).tex((double)f3, (double)f6).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)f15, (double)f17, (double)(-f2)).tex((double)f7, (double)f9).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f17, (double)(-f2)).tex((double)f8, (double)f9).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f17, (double)f2).tex((double)f8, (double)f10).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f17, (double)f2).tex((double)f7, (double)f10).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f18, (double)f2).tex((double)f7, (double)f9).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f18, (double)f2).tex((double)f8, (double)f9).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f18, (double)(-f2)).tex((double)f8, (double)f10).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f18, (double)(-f2)).tex((double)f7, (double)f10).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f17, (double)f2).tex((double)f12, (double)f13).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f18, (double)f2).tex((double)f12, (double)f14).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f18, (double)(-f2)).tex((double)f11, (double)f14).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f15, (double)f17, (double)(-f2)).tex((double)f11, (double)f13).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f17, (double)(-f2)).tex((double)f12, (double)f13).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f18, (double)(-f2)).tex((double)f12, (double)f14).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f18, (double)f2).tex((double)f11, (double)f14).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)f16, (double)f17, (double)f2).tex((double)f11, (double)f13).normal(1.0F, 0.0F, 0.0F).endVertex();
tessellator.draw();
}
}
}