Java Code Examples for net.minecraft.client.renderer.Tessellator#draw()
The following examples show how to use
net.minecraft.client.renderer.Tessellator#draw() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Render.java From mapwriter with MIT License | 7 votes |
public static void drawCircleBorder(double x, double y, double r, double width) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator tes = Tessellator.instance; tes.startDrawing(GL11.GL_TRIANGLE_STRIP); // for some the circle is only drawn if theta is decreasing rather than ascending double end = Math.PI * 2.0; double incr = end / circleSteps; double r2 = r + width; for (double theta = -incr; theta < end; theta += incr) { tes.addVertex(x + (r * Math.cos(-theta)), y + (r * Math.sin(-theta)), zDepth); tes.addVertex(x + (r2 * Math.cos(-theta)), y + (r2 * Math.sin(-theta)), zDepth); } tes.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
Example 2
Source File: BlockChorusFlowerRender.java From Et-Futurum with The Unlicense | 6 votes |
private void renderCube(RenderBlocks renderer, Block block, int meta) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); }
Example 3
Source File: Utils.java From SkyblockAddons with MIT License | 5 votes |
/** * Draws a solid color rectangle with the specified coordinates and color (ARGB format). Args: x1, y1, x2, y2, color */ public void drawRect(double left, double top, double right, double bottom, int color) { if (left < right) { double i = left; left = right; right = i; } if (top < bottom) { double 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(left, bottom, 0.0D).endVertex(); worldrenderer.pos(right, bottom, 0.0D).endVertex(); worldrenderer.pos(right, top, 0.0D).endVertex(); worldrenderer.pos(left, top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example 4
Source File: CachedRendererFactory.java From OpenModsLib with MIT License | 5 votes |
public DisplayListRenderer(Tessellator tes) { displayList = GL11.glGenLists(1); if (isDisplayListValid()) { GL11.glNewList(displayList, GL11.GL_COMPILE); tes.draw(); GL11.glEndList(); } }
Example 5
Source File: GuiElementBase.java From WearableBackpacks with MIT License | 5 votes |
public static void drawColoredRectARGB(int x, int y, int width, int height, float u1, float v1, float u2, float v2, int colorTL, int colorTR, int colorBL, int colorBR) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(x , y , 0).tex(u1, v1).color(colorTL >> 16 & 0xFF, colorTL >> 8 & 0xFF, colorTL & 0xFF, colorTL >> 24 & 0xFF).endVertex(); buffer.pos(x , y + height, 0).tex(u1, v2).color(colorBL >> 16 & 0xFF, colorBL >> 8 & 0xFF, colorBL & 0xFF, colorBL >> 24 & 0xFF).endVertex(); buffer.pos(x + width, y + height, 0).tex(u2, v2).color(colorBR >> 16 & 0xFF, colorBR >> 8 & 0xFF, colorBR & 0xFF, colorBR >> 24 & 0xFF).endVertex(); buffer.pos(x + width, y , 0).tex(u2, v1).color(colorTR >> 16 & 0xFF, colorTR >> 8 & 0xFF, colorTR & 0xFF, colorTR >> 24 & 0xFF).endVertex(); tessellator.draw(); }
Example 6
Source File: GLUtil.java From ClientBase with MIT License | 5 votes |
public static void drawRect(int mode, double left, double top, double right, double bottom, int color) { if (left < right) { double i = left; left = right; right = i; } if (top < bottom) { double 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(mode, DefaultVertexFormats.POSITION); worldrenderer.pos(left, bottom, 0.0D).endVertex(); worldrenderer.pos(right, bottom, 0.0D).endVertex(); worldrenderer.pos(right, top, 0.0D).endVertex(); worldrenderer.pos(left, top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example 7
Source File: GuiHelper.java From LunatriusCore with MIT License | 5 votes |
public static void drawItemStackSlot(final TextureManager textureManager, final int x, final int y) { textureManager.bindTexture(Gui.STAT_ICONS); final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder buffer = tessellator.getBuffer(); final double uScale = 1.0 / 128.0; final double vScale = 1.0 / 128.0; GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); drawTexturedRectangle(buffer, x + 1, y + 1, x + 1 + 18, y + 1 + 18, 0, uScale * 0, vScale * 0, uScale * 18, vScale * 18); tessellator.draw(); }
Example 8
Source File: RendererGlasBlock.java From bartworks with MIT License | 5 votes |
@Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; block.setBlockBoundsForItemRender(); renderer.setRenderBoundsFromBlock(block); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); }
Example 9
Source File: RenderSearchItemBlock.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public static void renderSearch(double x, double y, double z, int itemCount, int totalCount){ GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glColor4d(0, 1, 0, 0.5D); GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); // GL11.glLineWidth(1.0F); double ratio = (double)itemCount / totalCount; double diff = (1 - ratio) / 1.5D; double size = 1 - diff; /* for(double i = size; i > 0; i -= 0.06D) { GL11.glPushMatrix(); GL11.glScaled(i, i, i); renderCircle(); GL11.glPopMatrix(); } */ Tessellator tess = Tessellator.instance; tess.startDrawing(GL11.GL_QUADS); tess.addVertexWithUV(-size, size, 0, 0, 1); tess.addVertexWithUV(-size, -size, 0, 0, 0); tess.addVertexWithUV(size, -size, 0, 1, 0); tess.addVertexWithUV(size, size, 0, 1, 1); tess.draw(); GL11.glPopMatrix(); }
Example 10
Source File: SurfaceHelper.java From ForgeHax with MIT License | 5 votes |
public static void drawTexturedRect( int x, int y, int textureX, int textureY, int width, int height, int zLevel) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); BufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX); BufferBuilder.pos(x + 0, y + height, zLevel) .tex( (float) (textureX + 0) * 0.00390625F, (float) (textureY + height) * 0.00390625F) .endVertex(); BufferBuilder.pos(x + width, y + height, zLevel) .tex( (float) (textureX + width) * 0.00390625F, (float) (textureY + height) * 0.00390625F) .endVertex(); BufferBuilder.pos(x + width, y + 0, zLevel) .tex( (float) (textureX + width) * 0.00390625F, (float) (textureY + 0) * 0.00390625F) .endVertex(); BufferBuilder.pos(x + 0, y + 0, zLevel) .tex( (float) (textureX + 0) * 0.00390625F, (float) (textureY + 0) * 0.00390625F) .endVertex(); tessellator.draw(); }
Example 11
Source File: RenderCoordWireframe.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public void render(float partialTicks){ /* Block block = Block.blocksList[world.getBlockId(x, y, z)]; block.setBlockBoundsBasedOnState(world, x, y, z); double minX = block.getBlockBoundsMinX(); double minY = block.getBlockBoundsMinY(); double minZ = block.getBlockBoundsMinZ(); double maxX = minX + (block.getBlockBoundsMaxX() - minX) * progress; double maxY = minY + (block.getBlockBoundsMaxY() - minY) * progress; double maxZ = minZ + (block.getBlockBoundsMaxX() - minZ) * progress; */ double minX = 0; double minY = 0; double minZ = 0; double maxX = 1; double maxY = 1; double maxZ = 1; float progress = (ticksExisted % 20 + partialTicks) / 20; GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLineWidth(1.0F); // GL11.glColor4d(0, 1, 1, progress < 0.5F ? progress + 0.5F : 1.5 - progress); GL11.glColor4d(0, progress < 0.5F ? progress + 0.5F : 1.5 - progress, 1, 1); GL11.glPushMatrix(); // GL11.glTranslated(-0.5D, -0.5D, -0.5D); GL11.glTranslated(x, y, z); Tessellator tess = Tessellator.instance; tess.startDrawing(GL11.GL_LINES); tess.addVertex(minX, minY, minZ); tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, minY, maxZ); tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, minY, minZ); tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, minY, maxZ); tess.addVertex(maxX, maxY, maxZ); tess.addVertex(minX, minY, minZ); tess.addVertex(maxX, minY, minZ); tess.addVertex(minX, minY, maxZ); tess.addVertex(maxX, minY, maxZ); tess.addVertex(minX, maxY, minZ); tess.addVertex(maxX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, maxZ); tess.addVertex(minX, minY, minZ); tess.addVertex(minX, minY, maxZ); tess.addVertex(maxX, minY, minZ); tess.addVertex(maxX, minY, maxZ); tess.addVertex(minX, maxY, minZ); tess.addVertex(minX, maxY, maxZ); tess.addVertex(maxX, maxY, minZ); tess.addVertex(maxX, maxY, maxZ); tess.draw(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 12
Source File: BlockOverlayRender.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
private void drawFilledBoundingBox(AxisAlignedBB box) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldRenderer = tessellator.getWorldRenderer(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); tessellator.draw(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); tessellator.draw(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); tessellator.draw(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); tessellator.draw(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); tessellator.draw(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); tessellator.draw(); }
Example 13
Source File: RenderFukumame.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityFukumame entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 14
Source File: MixinGuiSlot.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_) { if(this.field_178041_q) { this.mouseX = mouseXIn; this.mouseY = mouseYIn; this.drawBackground(); int i = this.getScrollBarX(); int j = i + 6; this.bindAmountScrolled(); GlStateManager.disableLighting(); GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; int l = this.top + 4 - (int) this.amountScrolled; if (this.hasListHeader) { this.drawListHeader(k, l, tessellator); } RenderUtils.makeScissorBox(left, top, right, bottom); GL11.glEnable(GL11.GL_SCISSOR_TEST); this.drawSelectionBox(k, l + 2, mouseXIn, mouseYIn + 2); GL11.glDisable(GL11.GL_SCISSOR_TEST); GlStateManager.disableDepth(); int i1 = 4; // ClientCode ScaledResolution scaledResolution = new ScaledResolution(mc); Gui.drawRect(0, 0, scaledResolution.getScaledWidth(), this.top, Integer.MIN_VALUE); Gui.drawRect(0, this.bottom, scaledResolution.getScaledWidth(), this.height, Integer.MIN_VALUE); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); GlStateManager.disableAlpha(); GlStateManager.shadeModel(7425); GlStateManager.disableTexture2D(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(this.left, this.top + i1, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos(this.right, this.top + i1, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos(this.right, this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(this.left, this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); tessellator.draw(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(this.left, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(this.right, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(this.right, this.bottom - i1, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos(this.left, this.bottom - i1, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex(); tessellator.draw(); int j1 = this.func_148135_f(); if (j1 > 0) { int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); k1 = MathHelper.clamp_int(k1, 32, this.bottom - this.top - 8); int l1 = (int) this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top; if (l1 < this.top) { l1 = this.top; } worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(i, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(j, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(j, this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(i, this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); tessellator.draw(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(i, l1 + k1, 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(j, l1 + k1, 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(j, l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(i, l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex(); tessellator.draw(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(i, l1 + k1 - 1, 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos(j - 1, l1 + k1 - 1, 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos(j - 1, l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos(i, l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex(); tessellator.draw(); } this.func_148142_b(mouseXIn, mouseYIn); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(7424); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); } }
Example 15
Source File: GuiScreenPlus.java From Chisel with GNU General Public License v2.0 | 4 votes |
public void drawTiledRect(int rx, int ry, int rw, int rh, int u, int v, int tw, int th) { if(rw == 0 || rh == 0 || tw == 0 || th == 0) return; float pixel = 0.00390625f; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); for(int y = 0; y < rh; y += th) { for(int x = 0; x < rw; x += tw) { int qw = tw; if(x + qw > rw) { qw = rw - x; } int qh = th; if(y + qh > rh) { qh = rh - y; } double x1 = rx + x; double x2 = rx + x + qw; double y1 = ry + y; double y2 = ry + y + qh; double u1 = pixel * (u); double u2 = pixel * (u + tw); double v1 = pixel * (v); double v2 = pixel * (v + th); tessellator.addVertexWithUV(x1, y2, this.zLevel, u1, v2); tessellator.addVertexWithUV(x2, y2, this.zLevel, u2, v2); tessellator.addVertexWithUV(x2, y1, this.zLevel, u2, v1); tessellator.addVertexWithUV(x1, y1, this.zLevel, u1, v1); } } tessellator.draw(); }
Example 16
Source File: ParticleRenderer.java From Logistics-Pipes-2 with MIT License | 4 votes |
public void renderParticles(EntityPlayer aPlayer, float pTicks) { float f = ActiveRenderInfo.getRotationX(); float f1 = ActiveRenderInfo.getRotationZ(); float f2 = ActiveRenderInfo.getRotationYZ(); float f3 = ActiveRenderInfo.getRotationXY(); float f4 = ActiveRenderInfo.getRotationXZ(); EntityPlayer player = Minecraft.getMinecraft().player; if(player!=null) { Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * pTicks; Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * pTicks; Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * pTicks; Particle.cameraViewDir = player.getLook(pTicks); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.alphaFunc(516, 0.003921569F); GlStateManager.disableCull(); GlStateManager.depthMask(false); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); VertexBuffer buffer = tess.getBuffer(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int i = 0; i < particles.size(); i ++) { if(!((ILP2Particle) particles.get(i)).isAdditive()) { particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3); } } tess.draw(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int i = 0; i < particles.size(); i ++) { if(((ILP2Particle) particles.get(i)).isAdditive()) { particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3); } } tess.draw(); GlStateManager.enableCull(); GlStateManager.depthMask(true); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.alphaFunc(516, 0.1F); } }
Example 17
Source File: ItemRendererCertusTank.java From ExtraCells1 with MIT License | 4 votes |
public void renderItem(ItemRenderType type, ItemStack item, Object... data) { Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/blocks/texmap_tank.png")); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glScalef(1.0F, -1F, -1F); model.render(0.0625f); GL11.glScalef(1.0F, -1F, 1.0F); model.render(0.0625f); if (item != null && item.hasTagCompound()) { FluidStack storedFluid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity")); int tankCapacity = 32000; if (storedFluid != null && storedFluid.getFluid() != null) { Icon fluidIcon = storedFluid.getFluid().getIcon(); Tessellator tessellator = Tessellator.instance; RenderBlocks renderer = new RenderBlocks(); GL11.glScalef(1.0F, 1.0F, -1.0F); renderer.setRenderBounds(0.08F, 0.001F, 0.08F, 0.92, (float) storedFluid.amount / (float) tankCapacity * 0.999F, 0.92F); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1F, 0.0F); renderer.renderFaceYNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1F); renderer.renderFaceZNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1F, 0.0F, 0.0F); renderer.renderFaceXNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); GL11.glPopAttrib(); } } GL11.glPopMatrix(); }
Example 18
Source File: MoCRenderShark.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityShark entityshark = (MoCEntityShark) entityliving; super.doRenderLiving(entityshark, d, d1, d2, f, f1); boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entityshark.getName()).isEmpty(); boolean flag1 = MoCreatures.proxy.getDisplayPetHealth(); boolean flag2 = MoCreatures.proxy.getDisplayPetIcons(); if (entityshark.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityshark.getDistanceToEntity(renderManager.livingPlayer); if (f4 < 16F) { String s = ""; s = (new StringBuilder()).append(s).append(entityshark.getName()).toString(); float f5 = 0.1F; FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; if (flag1) { GL11.glDisable(3553 /* GL_TEXTURE_2D */); if (!flag) { byte0 += 8; } tessellator.startDrawingQuads(); // might break SSP float f6 = entityshark.getHealth(); float f7 = entityshark.getMaxHealth(); float f8 = f6 / f7; float f9 = 40F * f8; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); } if (flag) { GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } }
Example 19
Source File: RenderCrucible.java From ExNihiloAdscensio with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileCrucible te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tes = Tessellator.getInstance(); VertexBuffer wr = tes.getBuffer(); RenderHelper.disableStandardItemLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); SpriteColor sprite = te.getSpriteAndColor(); if (sprite != null) { TextureAtlasSprite icon = sprite.getSprite(); double minU = (double) icon.getMinU(); double maxU = (double) icon.getMaxU(); double minV = (double) icon.getMinV(); double maxV = (double) icon.getMaxV(); // determine the tint for the fluid/block Color color = sprite.getColor(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); //wr.begin(GL11.GL_QUADS, new VertexFormat().addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.NORMAL_3B)); // Offset by bottome of crucible, which is 4 pixels above the base of the block float fillAmount = (12F / 16F) * te.getFilledAmount() + (4F / 16F); wr.pos(0.125F, fillAmount, 0.125F).tex(minU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); wr.pos(0.125F, fillAmount, 0.875F).tex(minU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); wr.pos(0.875F, fillAmount, 0.875F).tex(maxU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); wr.pos(0.875F, fillAmount, 0.125F).tex(maxU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); tes.draw(); } GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); RenderHelper.enableStandardItemLighting(); }
Example 20
Source File: EnderChestRenderer.java From EnderStorage with MIT License | 4 votes |
private static void drawButton(int button, int colour, int rot, double lidAngle) { float texx = 0.25F * (colour % 4); float texy = 0.25F * (colour / 4); GL11.glPushMatrix(); EnderDyeButton ebutton = TileEnderChest.buttons[button].copy(); ebutton.rotate(0, 0.5625, 0.0625, 1, 0, 0, lidAngle); ebutton.rotateMeta(rot); Vector3[] verts = ebutton.verts; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); addVecWithUV(verts[7], texx + 0.0938, texy + 0.0625); addVecWithUV(verts[3], texx + 0.0938, texy + 0.1875); addVecWithUV(verts[2], texx + 0.1562, texy + 0.1875); addVecWithUV(verts[6], texx + 0.1562, texy + 0.0625); addVecWithUV(verts[4], texx + 0.0938, texy + 0.0313); addVecWithUV(verts[7], texx + 0.0938, texy + 0.0313); addVecWithUV(verts[6], texx + 0.1562, texy + 0.0624); addVecWithUV(verts[5], texx + 0.1562, texy + 0.0624); addVecWithUV(verts[0], texx + 0.0938, texy + 0.2186); addVecWithUV(verts[1], texx + 0.1562, texy + 0.2186); addVecWithUV(verts[2], texx + 0.1562, texy + 0.1876); addVecWithUV(verts[3], texx + 0.0938, texy + 0.1876); addVecWithUV(verts[6], texx + 0.1563, texy + 0.0626); addVecWithUV(verts[2], texx + 0.1563, texy + 0.1874); addVecWithUV(verts[1], texx + 0.1874, texy + 0.1874); addVecWithUV(verts[5], texx + 0.1874, texy + 0.0626); addVecWithUV(verts[7], texx + 0.0937, texy + 0.0626); addVecWithUV(verts[4], texx + 0.0626, texy + 0.0626); addVecWithUV(verts[0], texx + 0.0626, texy + 0.1874); addVecWithUV(verts[3], texx + 0.0937, texy + 0.1874); tessellator.draw(); GL11.glPopMatrix(); }