private void drawPlusAndMinus() { double scale = 0.05D; GL11.glPushMatrix(); GL11.glTranslated(0.26D, 13.95D / 16D, 0); GL11.glRotated(90, 1, 0, 0); GL11.glScaled(scale, scale, scale); GL11.glColor4d(0, 1, 0, 1); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); bufferBuilder.pos(-1, 0, 0).endVertex(); bufferBuilder.pos(1, 0, 0).endVertex(); bufferBuilder.pos(0, -1, 0).endVertex(); bufferBuilder.pos(0, 1, 0).endVertex(); tessellator.draw(); GL11.glTranslated(-0.52D / scale, 0, 0); GL11.glColor4d(1, 0, 0, 1); bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); bufferBuilder.pos(-1, 0, 0).endVertex(); bufferBuilder.pos(1, 0, 0).endVertex(); tessellator.draw(); GL11.glColor4d(1, 1, 1, 1); GL11.glPopMatrix(); }
@Override public void render() { FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture()); int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0); int height = getHeight() + (hasStepOutput() ? 10 : 0); Pair<Double, Double> maxUV = getMaxUV(); double u = maxUV.getLeft(); double v = maxUV.getRight(); BufferBuilder wr = Tessellator.getInstance().getBuffer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); wr.pos(0, 0, 0).tex(0, 0).endVertex(); wr.pos(0, height, 0).tex(0, v).endVertex(); wr.pos(width, height, 0).tex(u, v).endVertex(); wr.pos(width, 0, 0).tex(u, 0).endVertex(); Tessellator.getInstance().draw(); }
private void blitIcon(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(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos((double)(i + 0), (double)(p_178051_2_ + 32), 0.0D).tex(0.0D, 1.0D).endVertex(); vertexbuffer.pos((double)(i + 32), (double)(p_178051_2_ + 32), 0.0D).tex(1.0D, 1.0D).endVertex(); vertexbuffer.pos((double)(i + 32), (double)(p_178051_2_ + 0), 0.0D).tex(1.0D, 0.0D).endVertex(); vertexbuffer.pos((double)(i + 0), (double)(p_178051_2_ + 0), 0.0D).tex(0.0D, 0.0D).endVertex(); tessellator.draw(); }
public void renderPathLine(float p_190067_1_, Path p_190067_2_) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR); for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i) { PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i); if (this.addDistanceToPlayer(pathpoint) <= 40.0F) { float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F; int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F); int k = j >> 16 & 255; int l = j >> 8 & 255; int i1 = j & 255; vertexbuffer.pos((double)pathpoint.xCoord - this.xo + 0.5D, (double)pathpoint.yCoord - this.yo + 0.5D, (double)pathpoint.zCoord - this.zo + 0.5D).color(k, l, i1, 255).endVertex(); } } tessellator.draw(); }
/** * Draws a sprite from assets/textures/gui/container/stats_icons.png */ private void drawSprite(int p_146527_1_, int p_146527_2_, int p_146527_3_, int p_146527_4_) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(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)(p_146527_1_ + 0), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex(); vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex(); vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex(); vertexbuffer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex(); tessellator.draw(); }
private void func_148224_c(int p_148224_1_, int p_148224_2_, int p_148224_3_, int p_148224_4_) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(Gui.statIcons); float f = 0.0078125F; float f1 = 0.0078125F; int i = 18; int j = 18; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos((double)(p_148224_1_ + 0), (double)(p_148224_2_ + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 0) * 0.0078125F), (double)((float)(p_148224_4_ + 18) * 0.0078125F)).endVertex(); worldrenderer.pos((double)(p_148224_1_ + 18), (double)(p_148224_2_ + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 18) * 0.0078125F), (double)((float)(p_148224_4_ + 18) * 0.0078125F)).endVertex(); worldrenderer.pos((double)(p_148224_1_ + 18), (double)(p_148224_2_ + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 18) * 0.0078125F), (double)((float)(p_148224_4_ + 0) * 0.0078125F)).endVertex(); worldrenderer.pos((double)(p_148224_1_ + 0), (double)(p_148224_2_ + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 0) * 0.0078125F), (double)((float)(p_148224_4_ + 0) * 0.0078125F)).endVertex(); tessellator.draw(); }
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(); }
@SideOnly(Side.CLIENT) public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames) { boolean exclude; for (GroupObject groupObject : groupObjects) { exclude=false; for (String excludedGroupName : excludedGroupNames) { if (excludedGroupName.equalsIgnoreCase(groupObject.name)) { exclude=true; } } if(!exclude) { groupObject.render(tessellator.getBuffer()); } } }
private void renderBox(Tessellator p_190055_1_, VertexBuffer p_190055_2_, double p_190055_3_, double p_190055_5_, double p_190055_7_, double p_190055_9_, double p_190055_11_, double p_190055_13_, int p_190055_15_, int p_190055_16_, int p_190055_17_) { GlStateManager.glLineWidth(2.0F); p_190055_2_.begin(3, DefaultVertexFormats.POSITION_COLOR); p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_17_, p_190055_17_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_17_, p_190055_17_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_17_, p_190055_16_, p_190055_17_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex(); p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex(); p_190055_1_.draw(); GlStateManager.glLineWidth(1.0F); }
@Override protected void drawSlot(int idx, int right, int top, int height, Tessellator tess) { if(idx >= 0 && idx < channels.size()) { FontRenderer font = this.parent.getFontRenderer(); TileEntityGlassMaster channel = channels.get(idx); GlStateManager.pushMatrix(); GlStateManager.scale(0.5F, 0.5F, 1F); String info = (channel.setChannel.isEmpty() ? I18n.translateToLocal("glass.gui.notSet") : channel.setChannel.startsWith("public") ? I18n.translateToLocal("glass.gui.public") : "") + (!channel.setChannel.isEmpty() ? " " + channel.setChannel.substring(channel.setChannel.indexOf(":") + 1) : ""); info = info + " (" + channel.getPos().getX() + ", " + channel.getPos().getY() + ", " + channel.getPos().getZ() + ")"; String name = font.trimStringToWidth(info, (listWidth - 10) * 2); font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA); GlStateManager.popMatrix(); } }
@Override protected void drawSlot(int idx, int right, int top, int height, Tessellator tess) { if(idx >= 0 && idx < channels.size()) { FontRenderer font = this.parent.getFontRenderer(); String channel = channels.get(idx); GlStateManager.pushMatrix(); GlStateManager.scale(0.5F, 0.5F, 1F); String name = font.trimStringToWidth(channel.substring(channel.indexOf(":") + 1), (listWidth - 10) * 2); if(channel.startsWith("public:")) { name = I18n.translateToLocal("glass.gui.public") + " " + name; } font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA); GlStateManager.popMatrix(); } }
/** * Draws the background (i is always 0 as of 1.2.2) */ public void drawBackground(int tint) { GlStateManager.disableLighting(); GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); this.mc.getTextureManager().bindTexture(OPTIONS_BACKGROUND); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f = 32.0F; vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); vertexbuffer.pos(0.0D, (double)this.height, 0.0D).tex(0.0D, (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex(); vertexbuffer.pos((double)this.width, (double)this.height, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex(); vertexbuffer.pos((double)this.width, 0.0D, 0.0D).tex((double)((float)this.width / 32.0F), (double)tint).color(64, 64, 64, 255).endVertex(); vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)tint).color(64, 64, 64, 255).endVertex(); tessellator.draw(); }
private void renderPumpkinOverlay(ScaledResolution p_180476_1_) { GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableAlpha(); this.mc.getTextureManager().bindTexture(pumpkinBlurTexPath); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(0.0D, (double)p_180476_1_.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex(); worldrenderer.pos((double)p_180476_1_.getScaledWidth(), (double)p_180476_1_.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex(); worldrenderer.pos((double)p_180476_1_.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex(); worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
public void drawTexturedModalRectZ(final float i, final float y, final int k, final int i1, final int j1, final int k1, final float zLevel) { float f = 0.015625F; float f1 = 0.03125F; Tessellator tesselator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tesselator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); /* tesselator.getWorldRenderer().addVertexWithUV(i + 0, y + k1, zLevel, (k + 0) * f, (i1 + k1) * f1); tesselator.getWorldRenderer().addVertexWithUV(i + j1, y + k1, zLevel, (k + j1) * f, (i1 + k1) * f1); tesselator.getWorldRenderer().addVertexWithUV(i + j1, y + 0, zLevel, (k + j1) * f, (i1 + 0) * f1); tesselator.getWorldRenderer().addVertexWithUV(i + 0, y + 0, zLevel, (k + 0) * f, (i1 + 0) * f1); */ vertexbuffer.pos(i + 0, y + k1, zLevel); vertexbuffer.pos(i + j1, y + k1, zLevel); vertexbuffer.pos(i + j1, y + 0, zLevel); vertexbuffer.pos(i + 0, y + 0, zLevel); tesselator.draw(); }
private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { double uMin = (double) textureSprite.getMinU(); double uMax = (double) textureSprite.getMaxU(); double vMin = (double) textureSprite.getMinV(); double vMax = (double) textureSprite.getMaxV(); uMax = uMax - (maskRight / 16.0 * (uMax - uMin)); vMax = vMax - (maskTop / 16.0 * (vMax - vMin)); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex(); bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex(); bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex(); bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex(); tessellator.draw(); }
/** * Overlays the background to hide scrolled items */ protected void overlayBackground(int startY, int endY, int startAlpha, int endAlpha) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.mc.getTextureManager().bindTexture(Gui.optionsBackground); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f = 32.0F; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos((double)this.left, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); worldrenderer.pos((double)(this.left + this.width), (double)endY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); worldrenderer.pos((double)(this.left + this.width), (double)startY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); worldrenderer.pos((double)this.left, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); tessellator.draw(); }
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityDragonFireball 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(2.0F, 2.0F, 2.0F); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); float f = 1.0F; float f1 = 0.5F; float f2 = 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(0.0D, 1.0D).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(0.5D, -0.25D, 0.0D).tex(1.0D, 1.0D).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(0.5D, 0.75D, 0.0D).tex(1.0D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(-0.5D, 0.75D, 0.0D).tex(0.0D, 0.0D).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); }
/** * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */ public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.field_175349_r.drawScreen(mouseX, mouseY, partialTicks); this.drawCenteredString(this.fontRendererObj, this.field_175341_a, this.width / 2, 2, 16777215); this.drawCenteredString(this.fontRendererObj, this.field_175333_f, this.width / 2, 12, 16777215); this.drawCenteredString(this.fontRendererObj, this.field_175335_g, this.width / 2, 22, 16777215); super.drawScreen(mouseX, mouseY, partialTicks); if (this.field_175339_B != 0) { drawRect(0, 0, this.width, this.height, Integer.MIN_VALUE); this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 99, -2039584); this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 185, -6250336); this.drawVerticalLine(this.width / 2 - 91, 99, 185, -2039584); this.drawVerticalLine(this.width / 2 + 90, 99, 185, -6250336); float f = 85.0F; float f1 = 180.0F; GlStateManager.disableLighting(); GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.mc.getTextureManager().bindTexture(optionsBackground); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f2 = 32.0F; worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos((double)(this.width / 2 - 90), 185.0D, 0.0D).tex(0.0D, 2.65625D).color(64, 64, 64, 64).endVertex(); worldrenderer.pos((double)(this.width / 2 + 90), 185.0D, 0.0D).tex(5.625D, 2.65625D).color(64, 64, 64, 64).endVertex(); worldrenderer.pos((double)(this.width / 2 + 90), 100.0D, 0.0D).tex(5.625D, 0.0D).color(64, 64, 64, 64).endVertex(); worldrenderer.pos((double)(this.width / 2 - 90), 100.0D, 0.0D).tex(0.0D, 0.0D).color(64, 64, 64, 64).endVertex(); tessellator.draw(); this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirmTitle", new Object[0]), this.width / 2, 105, 16777215); this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm1", new Object[0]), this.width / 2, 125, 16777215); this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm2", new Object[0]), this.width / 2, 135, 16777215); this.field_175352_x.drawButton(this.mc, mouseX, mouseY); this.field_175351_y.drawButton(this.mc, mouseX, mouseY); } }
/** * Compiles a GL display list for this model */ private void compileDisplayList(float scale) { this.displayList = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.displayList, GL11.GL_COMPILE); WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer(); for (int i = 0; i < this.cubeList.size(); ++i) { ((ModelBox)this.cubeList.get(i)).render(worldrenderer, scale); } GL11.glEndList(); this.compiled = true; }
/** * Renders a white box with the bounds of the AABB trasnlated by an offset. */ public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z) { GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); vertexbuffer.setTranslation(x, y, z); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_NORMAL); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); tessellator.draw(); vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D); GlStateManager.enableTexture2D(); }
/** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { int i = (int)(((float)this.life + partialTicks) * 3.0F / (float)this.lifeTime); if (i <= 7) { this.textureManager.bindTexture(SWEEP_TEXTURE); float f = (float)(i % 4) / 4.0F; float f1 = f + 0.24975F; float f2 = (float)(i / 2) / 2.0F; float f3 = f2 + 0.4995F; float f4 = 1.0F * this.size; float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); RenderHelper.disableStandardItemLighting(); worldRendererIn.begin(7, VERTEX_FORMAT); worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4 * 0.5F), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4 * 0.5F), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4 * 0.5F), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4 * 0.5F), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); Tessellator.getInstance().draw(); GlStateManager.enableLighting(); } }
private void renderMirror(float age, float offset, float scale) { GlStateManager.pushMatrix(); Tuple<Double, Double> uv = SpriteLibrary.QUANTUM_MIRROR.getUVFrame((int) (age * 0.25F)); double vOffset = SpriteLibrary.QUANTUM_MIRROR.getV(); double v = uv.getSecond(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buff = tessellator.getBuffer(); GlStateManager.translate(0.5F, 0.5F, 0F); GlStateManager.scale(scale, scale, scale); GlStateManager.rotate(offset - age, 0F, 1F, 0F); GlStateManager.rotate(offset - age, 1F, 0F, 0F); GlStateManager.rotate(offset - age, 0F, 0F, 1F); GlStateManager.translate(-0.5F, -0.5F, 0F); buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); buff.pos(0, 0, 0).tex(0, v).endVertex(); buff.pos(1, 0, 0).tex(1, v).endVertex(); buff.pos(1, 1, 0).tex(1, v + vOffset).endVertex(); buff.pos(0, 1, 0).tex(0, v + vOffset).endVertex(); tessellator.draw(); GlStateManager.popMatrix(); }
/** * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height */ public static void drawTexturedModalRect1(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)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex(); worldrenderer.pos((double)(x + width), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex(); worldrenderer.pos((double)(x + width), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex(); worldrenderer.pos((double)(x + 0), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex(); tessellator.draw(); }
private static void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) { renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); renderer.pos((double) (x), (double) (y), 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((double) (x), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((double) (x + width), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((double) (x + width), (double) (y), 0.0D).color(red, green, blue, alpha).endVertex(); Tessellator.getInstance().draw(); }
private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_) { this.mc.getFramebuffer().unbindFramebuffer(); GlStateManager.viewport(0, 0, 256, 256); this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.rotateAndBlurSkybox(p_73971_3_); this.mc.getFramebuffer().bindFramebuffer(true); GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); float f = this.width > this.height ? 120.0F / (float) this.width : 120.0F / (float) this.height; float f1 = (float) this.height * f / 256.0F; float f2 = (float) this.width * f / 256.0F; int i = this.width; int j = this.height; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(0.0D, (double) j, (double) this.zLevel).tex((double) (0.5F - f1), (double) (0.5F + f2)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); worldrenderer.pos((double) i, (double) j, (double) this.zLevel).tex((double) (0.5F - f1), (double) (0.5F - f2)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); worldrenderer.pos((double) i, 0.0D, (double) this.zLevel).tex((double) (0.5F + f1), (double) (0.5F - f2)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); worldrenderer.pos(0.0D, 0.0D, (double) this.zLevel).tex((double) (0.5F + f1), (double) (0.5F + f2)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); tessellator.draw(); }
@Override public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer VertexBuffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); GlStateManager.disableCull(); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, VertexBuffer); VertexBuffer.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); }
/** Renders the given texture tiled into a GUI */ static void renderTiledTextureAtlas(int x, int y, int width, int height, float depth, TextureAtlasSprite sprite) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder worldRenderer = tessellator.getBuffer(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); putTiledTextureQuads(worldRenderer, x, y, width, height, depth, sprite); tessellator.draw(); }
/** * Rotate and blurs the skybox view in the main menu */ private void rotateAndBlurSkybox(float p_73968_1_) { this.mc.getTextureManager().bindTexture(this.backgroundTexture); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.colorMask(true, true, true, false); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); GlStateManager.disableAlpha(); int i = 3; for (int j = 0; j < i; ++j) { float f = 1.0F / (float)(j + 1); int k = this.width; int l = this.height; float f1 = (float)(j - i / 2) / 256.0F; worldrenderer.pos((double)k, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); worldrenderer.pos((double)k, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); worldrenderer.pos(0.0D, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); } tessellator.draw(); GlStateManager.enableAlpha(); GlStateManager.colorMask(true, true, true, true); }
/** * Utility method for rendering an atlas texture as the front-side overlay * over a specified horizontal area. * * @param texture the atlas texture to use to render the overlay. * @param u0 the lower end of the vertical area to render at. * @param u1 the upper end of the vertical area to render at. */ public void renderOverlayFromAtlas(final ResourceLocation texture, final float u0, final float u1) { Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); final TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString()); final Tessellator t = Tessellator.getInstance(); final VertexBuffer r = t.getBuffer(); r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); r.pos(u0, v1, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v1 * 16)).endVertex(); r.pos(u1, v1, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v1 * 16)).endVertex(); r.pos(u1, v0, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v0 * 16)).endVertex(); r.pos(u0, v0, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v0 * 16)).endVertex(); t.draw(); }
/** * Draws a scaled, textured, tiled modal rect at z = 0. This method isn't used anywhere in vanilla code. */ public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight) { float f = 1.0F / tileWidth; float f1 = 1.0F / tileHeight; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex(); worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex(); worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex(); worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex(); tessellator.draw(); }
private void func_181565_a(WorldRenderer p_181565_1_, int p_181565_2_, int p_181565_3_, int p_181565_4_, int p_181565_5_, int p_181565_6_, int p_181565_7_, int p_181565_8_, int p_181565_9_) { p_181565_1_.begin(7, DefaultVertexFormats.POSITION_COLOR); p_181565_1_.pos((double)(p_181565_2_ + 0), (double)(p_181565_3_ + 0), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); p_181565_1_.pos((double)(p_181565_2_ + 0), (double)(p_181565_3_ + p_181565_5_), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); p_181565_1_.pos((double)(p_181565_2_ + p_181565_4_), (double)(p_181565_3_ + p_181565_5_), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); p_181565_1_.pos((double)(p_181565_2_ + p_181565_4_), (double)(p_181565_3_ + 0), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); Tessellator.getInstance().draw(); }
/** * Draw this primitve. This is typically called only once as the generated drawing instructions are saved by the * renderer and reused later. */ public void draw(VertexBuffer renderer, float scale) { Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D); Vec3d vec3d1 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[2].vector3D); Vec3d vec3d2 = vec3d1.crossProduct(vec3d).normalize(); float f = (float)vec3d2.xCoord; float f1 = (float)vec3d2.yCoord; float f2 = (float)vec3d2.zCoord; if (this.invertNormal) { f = -f; f1 = -f1; f2 = -f2; } if (Config.isShaders()) { renderer.begin(7, SVertexFormat.defVertexFormatTextured); } else { renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); } for (int i = 0; i < 4; ++i) { PositionTextureVertex positiontexturevertex = this.vertexPositions[i]; renderer.pos(positiontexturevertex.vector3D.xCoord * (double)scale, positiontexturevertex.vector3D.yCoord * (double)scale, positiontexturevertex.vector3D.zCoord * (double)scale).tex((double)positiontexturevertex.texturePositionX, (double)positiontexturevertex.texturePositionY).normal(f, f1, f2).endVertex(); } Tessellator.getInstance().draw(); }
/** * Draws a solid color rectangle with the specified coordinates and color (ARGB format). Args: x1, y1, x2, y2, color */ public static void drawRect(int left, int top, int right, int bottom, int color) { if (left < right) { int i = left; left = right; right = i; } if (top < bottom) { int j = top; top = bottom; bottom = j; } float f3 = (float)(color >> 24 & 255) / 255.0F; float f = (float)(color >> 16 & 255) / 255.0F; float f1 = (float)(color >> 8 & 255) / 255.0F; float f2 = (float)(color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(f, f1, f2, f3); worldrenderer.begin(7, DefaultVertexFormats.POSITION); worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex(); worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex(); worldrenderer.pos((double)right, (double)top, 0.0D).endVertex(); worldrenderer.pos((double)left, (double)top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
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(); }
/** * Draws the blue selection box. */ private void drawSelectionBox(int startX, int startY, int endX, int endY) { if (startX < endX) { int i = startX; startX = endX; endX = i; } if (startY < endY) { int j = startY; startY = endY; endY = j; } if (endX > this.x + this.width) { endX = this.x + this.width; } if (startX > this.x + this.width) { startX = this.x + this.width; } Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F); GlStateManager.disableTexture2D(); GlStateManager.enableColorLogic(); GlStateManager.colorLogicOp(GlStateManager.LogicOp.OR_REVERSE); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); bufferbuilder.pos((double) startX, (double) endY, 0.0D).endVertex(); bufferbuilder.pos((double) endX, (double) endY, 0.0D).endVertex(); bufferbuilder.pos((double) endX, (double) startY, 0.0D).endVertex(); bufferbuilder.pos((double) startX, (double) startY, 0.0D).endVertex(); tessellator.draw(); GlStateManager.disableColorLogic(); GlStateManager.enableTexture2D(); }
public static void drawTexture(int x, int y, float u, float v, float uWidth, float vHeight, int width, int height, float tileWidth, float tileHeight) { float f = 1.0F / tileWidth; float f1 = 1.0F / tileHeight; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + vHeight) * f1)).endVertex(); bufferbuilder.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + uWidth) * f), (double)((v + vHeight) * f1)).endVertex(); bufferbuilder.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + uWidth) * f), (double)(v * f1)).endVertex(); bufferbuilder.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex(); tessellator.draw(); }
public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-viewerYaw, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)(isThirdPersonFrontal ? -1 : 1) * viewerPitch, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-0.025F, -0.025F, 0.025F); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); int i = fontRendererIn.getStringWidth(str) / 2; GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos((double)(-i - 1), (double)(-1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos((double)(-i - 1), (double)(8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos((double)(i + 1), (double)(8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos((double)(i + 1), (double)(-1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.depthMask(true); fontRendererIn.drawString(str, -fontRendererIn.getStringWidth(str) / 2, verticalShift, -1); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); }
private void drawWinGameScreen(int p_146575_1_, int p_146575_2_, float p_146575_3_) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.mc.getTextureManager().bindTexture(Gui.optionsBackground); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); int i = this.width; float f = 0.0F - ((float)this.field_146581_h + p_146575_3_) * 0.5F * this.field_146578_s; float f1 = (float)this.height - ((float)this.field_146581_h + p_146575_3_) * 0.5F * this.field_146578_s; float f2 = 0.015625F; float f3 = ((float)this.field_146581_h + p_146575_3_ - 0.0F) * 0.02F; float f4 = (float)(this.field_146579_r + this.height + this.height + 24) / this.field_146578_s; float f5 = (f4 - 20.0F - ((float)this.field_146581_h + 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; worldrenderer.pos(0.0D, (double)this.height, (double)this.zLevel).tex(0.0D, (double)(f * f2)).color(f3, f3, f3, 1.0F).endVertex(); worldrenderer.pos((double)i, (double)this.height, (double)this.zLevel).tex((double)((float)i * f2), (double)(f * f2)).color(f3, f3, f3, 1.0F).endVertex(); worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)((float)i * f2), (double)(f1 * f2)).color(f3, f3, f3, 1.0F).endVertex(); worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex(0.0D, (double)(f1 * f2)).color(f3, f3, f3, 1.0F).endVertex(); tessellator.draw(); }
/** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge; f = f * f; float f1 = 2.0F - f * 2.0F; if (f1 > 1.0F) { f1 = 1.0F; } f1 = f1 * 0.2F; GlStateManager.disableLighting(); float f2 = 0.125F; float f3 = (float)(this.posX - interpPosX); float f4 = (float)(this.posY - interpPosY); float f5 = (float)(this.posZ - interpPosZ); float f6 = this.worldObj.getLightBrightness(new BlockPos(this.posX, this.posY, this.posZ)); this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); worldRendererIn.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex(); worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex(); worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex(); worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex(); Tessellator.getInstance().draw(); GlStateManager.disableBlend(); GlStateManager.enableLighting(); }
public void render(int p_152437_1_, int p_152437_2_) { if (this.mc.getTwitchStream().isBroadcasting()) { GlStateManager.enableBlend(); int i = this.mc.getTwitchStream().func_152920_A(); if (i > 0) { String s = "" + i; int j = this.mc.fontRendererObj.getStringWidth(s); int k = 20; int l = p_152437_1_ - j - 1; int i1 = p_152437_2_ + 20 - 1; int j1 = p_152437_2_ + 20 + this.mc.fontRendererObj.FONT_HEIGHT - 1; GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.color(0.0F, 0.0F, 0.0F, (0.65F + 0.35000002F * this.field_152443_c) / 2.0F); worldrenderer.begin(7, DefaultVertexFormats.POSITION); worldrenderer.pos((double)l, (double)j1, 0.0D).endVertex(); worldrenderer.pos((double)p_152437_1_, (double)j1, 0.0D).endVertex(); worldrenderer.pos((double)p_152437_1_, (double)i1, 0.0D).endVertex(); worldrenderer.pos((double)l, (double)i1, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); this.mc.fontRendererObj.drawString(s, p_152437_1_ - j, p_152437_2_ + 20, 16777215); } this.render(p_152437_1_, p_152437_2_, this.func_152440_b(), 0); this.render(p_152437_1_, p_152437_2_, this.func_152438_c(), 17); } }