Java Code Examples for org.lwjgl.opengl.GL11#glPopAttrib()
The following examples show how to use
org.lwjgl.opengl.GL11#glPopAttrib() .
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: ItemWrapperMethods.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@Override default void renderItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { Item item = ItemConverter.instance().toNova(itemStack); if (item.components.has(Renderer.class)) { GL11.glPushAttrib(GL_TEXTURE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); Tessellator.instance.startDrawingQuads(); BWModel model = new BWModel(); model.matrix.rotate(Direction.UP.toVector(), 1 / 4 * Math.PI); model.matrix.rotate(Direction.EAST.toVector(), 1 / 6 * Math.PI); model.matrix.scale(1.6, 1.6, 1.6); item.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model)); model.render(); Tessellator.instance.draw(); GL11.glPopMatrix(); GL11.glPopAttrib(); } }
Example 2
Source File: FWBlock.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) @Override public void renderInventoryBlock(net.minecraft.block.Block block, int metadata, int modelId, RenderBlocks renderBlocks) { if (this.dummy.components.has(Renderer.class)) { GL11.glPushAttrib(GL_TEXTURE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); Tessellator.instance.startDrawingQuads(); BWModel model = new BWModel(); this.dummy.components.getSet(Renderer.class).forEach(renderer -> renderer.onRender.accept(model)); model.render(); Tessellator.instance.draw(); GL11.glPopMatrix(); GL11.glPopAttrib(); } }
Example 3
Source File: SlickCallable.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Leave a safe block ensuring that all of Slick's OpenGL state is * restored since the last enter. */ public static void leaveSafeBlock() { if (!inSafe) { return; } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glPopClientAttrib(); GL11.glPopAttrib(); if (lastUsed != null) { lastUsed.bind(); } else { TextureImpl.bindNone(); } inSafe = false; }
Example 4
Source File: GuiResearchRecipeAuraEffects.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
private void drawAuraAspectPagePre(ResearchPage page, int side, int x, int y, int mx, int my, int thisPage) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; //We know the name of that research. researchName = StatCollector.translateToLocal(researchName); if ((thisPage == 0) && (side == 0)) { drawTexturedModalRect(x + 4, y - 13, 24, 184, 96, 4); drawTexturedModalRect(x + 4, y + 4, 24, 184, 96, 4); int offset = this.fontRendererObj.getStringWidth(researchName); if (offset <= 130) { this.fontRendererObj.drawString(researchName, x + 52 - offset / 2, y - 6, 3158064); } else { float vv = 130.0F / offset; GL11.glPushMatrix(); GL11.glTranslatef(x + 52 - offset / 2 * vv, y - 6.0F * vv, 0.0F); GL11.glScalef(vv, vv, vv); this.fontRendererObj.drawString(researchName, 0, 0, 3158064); GL11.glPopMatrix(); } y += 25; } GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); drawAuraPage(side, x - 8, y - 8, mx, my, page.aspects); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glPopAttrib(); }
Example 5
Source File: InfusionClawGui.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { if(((TileInfusionClaw)container.clawInv).isInvalid()) { Minecraft.getMinecraft().displayGuiScreen(null); return; } ItemStack cursorStack = container.playerInv.getItemStack(); if(((TileInfusionClaw)container.clawInv).isRunning() || (cursorStack != null && cursorStack.stackSize > 0 && !container.clawInv.isItemValidForSlot(0, cursorStack))) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 0.5f); this.mc.renderEngine.bindTexture(BACKGROUND); float t = this.zLevel; this.zLevel = 200.0F; GL11.glEnable(3042); drawTexturedModalRect(80, 32, 240, 0, 16, 16); GL11.glDisable(3042); this.zLevel = t; GL11.glPopAttrib(); } }
Example 6
Source File: RenderShip.java From archimedes-ships with MIT License | 6 votes |
public void renderVehicle(EntityShip entity, double x, double y, double z, float yaw, float rendertime) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT); RenderHelper.disableStandardItemLighting(); float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * rendertime; float rx = entity.frontDirection == 1 ? -1f : entity.frontDirection == 3 ? 1f : 0f; float rz = entity.frontDirection == 0 ? 1f : entity.frontDirection == 2 ? -1f : 0f; GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glRotatef(yaw, 0F, 1F, 0F); GL11.glRotatef(pitch, rx, 0f, rz); float fx = entity.getShipChunk().getCenterX(); float fz = entity.getShipChunk().getCenterZ(); GL11.glTranslatef(-fx, -entity.getShipChunk().minY(), -fz); //minY is always 0 //float f4 = 0.75F; bindEntityTexture(entity); ((MobileChunkClient) entity.getShipChunk()).getRenderer().render(0F); GL11.glPopMatrix(); GL11.glPopAttrib(); }
Example 7
Source File: GuiGardenLayout.java From GardenCollection with MIT License | 5 votes |
@Override protected void drawGuiContainerForegroundLayer (int p_146979_1_, int p_146979_2_) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); String name = tileGarden.hasCustomInventoryName() ? tileGarden.getInventoryName() : I18n.format(tileGarden.getInventoryName(), new Object[0]); fontRendererObj.drawString(name, 8, 6, 4210752); fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752); for (int i = 0, n = inventorySlots.inventorySlots.size(); i < n; i++) drawSlotHighlight(inventorySlots.getSlot(i)); GL11.glPopAttrib(); }
Example 8
Source File: FBOGraphics.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.Graphics#disable() */ protected void disable() { GL.flush(); unbind(); GL11.glPopClientAttrib(); GL11.glPopAttrib(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); SlickCallable.leaveSafeBlock(); }
Example 9
Source File: BeefGuiBase.java From BigReactors with MIT License | 5 votes |
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { int absoluteX, absoluteY; absoluteX = mouseX - this.guiLeft; absoluteY = mouseY - this.guiTop; for(IBeefGuiControl c : controls) { c.drawForeground(this.mc.renderEngine, mouseX, mouseY); } for(IBeefTooltipControl tc: controlsWithTooltips) { if(tc.isVisible() && tc.isMouseOver(mouseX, mouseY)) { String[] tooltip = tc.getTooltip(); if(tooltip != null) { // This prevents weird rendering issues with NEI GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); drawHoveringText(Arrays.asList(tooltip), absoluteX, absoluteY, fontRendererObj); GL11.glPopAttrib(); break; } } } if(this.grabbedItem != null) { // Render grabbed item next to mouse this.mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture); GL11.glColor4f(1f, 1f, 1f, 1f); this.drawTexturedModelRectFromIcon(absoluteX+1, absoluteY+1, this.grabbedItem.getIcon(), 16, 16); } }
Example 10
Source File: TerminalManagerClient.java From OpenPeripheral-Addons with MIT License | 5 votes |
private void tryDrawSurface(long guid, SurfaceType type, float partialTicks, ScaledResolution resolution) { SurfaceClient surface = surfaces.get(guid, type); if (surface != null) { GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_ENABLE_BIT); GL11.glShadeModel(GL11.GL_SMOOTH); final RenderState renderState = new RenderState(); renderState.forceKnownState(); for (Drawable drawable : surface.getSortedDrawables()) if (drawable.shouldRender()) drawable.draw(resolution, renderState, partialTicks); GL11.glPopAttrib(); } }
Example 11
Source File: GuiCompostBin.java From GardenCollection with MIT License | 5 votes |
@Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); String name = this.tileCompost.hasCustomInventoryName() ? this.tileCompost.getInventoryName() : I18n.format(this.tileCompost.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); for (int i = 0, n = inventorySlots.inventorySlots.size(); i < n; i++) drawSlotHighlight(inventorySlots.getSlot(i)); GL11.glPopAttrib(); }
Example 12
Source File: GuiTextArea.java From pycode-minecraft with MIT License | 4 votes |
public void drawEditor() { String content = getString(); // first up, determine the scroll offset int xoff = textXOffset / SCROLL_SCALE; int yoff = textYOffset / SCROLL_SCALE; if (yoff > 0) { yoff = 0; textYOffset = 0; } else { int totHeight = -this.fontRenderer.FONT_HEIGHT * this.lines.length; if (totHeight < height && yoff < totHeight + height) { yoff = totHeight + height; textYOffset = yoff * SCROLL_SCALE; } } if (xoff < 0) { xoff = 0; textXOffset = 0; } else { int maxWidth = 0; for (String line : this.lines) { int w = this.fontRenderer.getStringWidth(line); if (w > maxWidth) maxWidth = w; } if (maxWidth > width && xoff > maxWidth - width) { xoff = maxWidth - width; textXOffset = xoff * SCROLL_SCALE; } } // offset rendering by the scroll offset GlStateManager.pushMatrix(); GlStateManager.translate(-xoff, yoff, 0); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor(xScissor, yScissor, wScissor, hScissor); // draw cursor int cursorPos; if (this.cursorRow == this.lines.length) { cursorPos = 0; // current line is empty } else { cursorPos = this.fontRenderer.getStringWidth(this.lines[this.cursorRow].substring(0, this.cursorColumn)); } int cursor_x = this.xPosition + cursorPos; int cursor_y = this.yPosition + this.cursorRow * this.fontRenderer.FONT_HEIGHT + 1; if (this.cursorCounter / 6 % 2 == 0) { this.fontRenderer.drawString("_", cursor_x, cursor_y, 0); } else { this.fontRenderer.drawString("_", cursor_x, cursor_y, 0x55000000); } // draw content int x = this.xPosition; int y = this.yPosition; for (String s : this.lines) { this.fontRenderer.drawString(s, x, y, 0); y += this.fontRenderer.FONT_HEIGHT; } // reset state GlStateManager.popMatrix(); GL11.glPopAttrib(); }
Example 13
Source File: OffscreenRenderer.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
protected static void popGLState() { GLStateStack.popState(); GL11.glPopAttrib(); GL11.glGetError(); // FIXME: Swallow error because of bug in (at least) the r300 DRI drivers }
Example 14
Source File: RocketEventHandler.java From AdvancedRocketry with MIT License | 4 votes |
public static void onPostWorldRender(float partialTicks) { if(!mapReady ) return; if(mapNeedsBinding) { mapNeedsBinding = false; earth.setByteBuffer(table); outerBounds.setByteBuffer(outerBoundsTable); } GL11.glPushMatrix(); GL11.glTranslatef(0, -5, 0); GL11.glPushAttrib(GL11.GL_ALPHA_TEST_FUNC); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_FOG); GL11.glAlphaFunc(GL11.GL_GREATER, .01f); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float brightness = 16; if(Minecraft.getMinecraft().getRenderViewEntity() != null && Minecraft.getMinecraft().getRenderViewEntity().world != null) brightness = Minecraft.getMinecraft().getRenderViewEntity().world.getSunBrightness(partialTicks); double deltaY = (Minecraft.getMinecraft().getRenderViewEntity().posY - Minecraft.getMinecraft().getRenderViewEntity().lastTickPosY)*partialTicks; double size = (getImgSize*5/(72-Minecraft.getMinecraft().getRenderViewEntity().posY - deltaY)); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); //Less detailed land buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GL11.glBindTexture(GL11.GL_TEXTURE_2D, outerBounds.getTextureId()); double size2 = size*16; float brightness2 =brightness*.43f; GlStateManager.color(brightness2, brightness2, brightness2, MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/50f, 0f, 1f)); RenderHelper.renderTopFaceWithUV(buffer, -10.1, size2, size2, -size2, -size2, 0, 1, 0, 1); Tessellator.getInstance().draw(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GL11.glBindTexture(GL11.GL_TEXTURE_2D, earth.getTextureId()); float opacityFromHeight = MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/100f, 0f, 1f); //Detailed Land GlStateManager.color(brightness2, brightness2, brightness2, MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/50f, 0f, 1f)); RenderHelper.renderTopFaceWithUV(buffer, -10 , size, size, -size, -size, 0f, 1f, 0f, 1f); Tessellator.getInstance().draw(); //AtmosphereGlow Vec3d skyColor = Minecraft.getMinecraft().getRenderViewEntity().world.provider.getSkyColor(Minecraft.getMinecraft().getRenderViewEntity(), partialTicks); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D,0); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL); GlStateManager.color((float)skyColor.x, (float)skyColor.y, (float)skyColor.z, 0.05f); size = (getImgSize*100/(180-Minecraft.getMinecraft().getRenderViewEntity().posY - deltaY)); for(int i = 0; i < 5 * MathHelper.clamp(( ( DimensionManager.getInstance().getDimensionProperties(Minecraft.getMinecraft().getRenderViewEntity().world.provider.getDimension()).getAtmosphereDensity() *.01f * (float)Minecraft.getMinecraft().getRenderViewEntity().posY -280f) )/150f, 0f, 2f); i++) { RenderHelper.renderTopFace(buffer, -9 + i*.6, size, size, -size , -size); } // GL11.glEnable(GL11.GL_TEXTURE_2D); Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_FOG); GL11.glPopAttrib(); GL11.glPopMatrix(); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); }
Example 15
Source File: RotorSpecialRenderer.java From BigReactors with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { TileEntityTurbineRotorBearing bearing = (TileEntityTurbineRotorBearing)tileentity; if(bearing == null || !bearing.isConnected()) { return; } MultiblockTurbine turbine = bearing.getTurbine(); if(!turbine.isAssembled() || !turbine.getActive() || !turbine.hasGlass()) { return; } Integer displayList = bearing.getDisplayList(); ForgeDirection rotorDir = bearing.getOutwardsDir().getOpposite(); if(displayList == null) { RotorInfo info = bearing.getRotorInfo(); displayList = generateRotor(info); bearing.setDisplayList(displayList); } float angle = bearing.getAngle(); long elapsedTime = Minecraft.getSystemTime() - ClientProxy.lastRenderTime; float speed = turbine.getRotorSpeed(); if(speed > 0.001f) { angle += speed * ((float)elapsedTime / 60000f) * 360f; // RPM * time in minutes * 360 degrees per rotation angle = angle % 360f; bearing.setAngle(angle); } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); bindTexture(net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture); GL11.glTranslated(x + rotorDir.offsetX, y + rotorDir.offsetY, z + rotorDir.offsetZ); if(rotorDir.offsetX != 0) { GL11.glTranslated(0, 0.5, 0.5); } else if(rotorDir.offsetY != 0) { GL11.glTranslated(0.5, 0, 0.5); } else if(rotorDir.offsetZ != 0) { GL11.glTranslated(0.5, 0.5, 0); } GL11.glRotatef(angle, rotorDir.offsetX, rotorDir.offsetY, rotorDir.offsetZ); GL11.glColor3f(1f, 1f, 1f); GL11.glCallList(displayList); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopAttrib(); GL11.glPopMatrix(); }
Example 16
Source File: OpenGLHelper.java From Et-Futurum with The Unlicense | 4 votes |
public static void popAttrib() { GL11.glPopAttrib(); }
Example 17
Source File: RenderTileStickyJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { if(tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) { TileStickyJar stickyJar = (TileStickyJar) tile; TileJarFillable parent = stickyJar.getParent(); World world = tile.getWorldObj(); Block block = stickyJar.getParentBlock(); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing)); //TESR TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent); if(renderer != null) { stickyJar.syncToParent(); renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks); stickyJar.syncFromParent(); } //ISimpleBlockHandler GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bindTexture(TextureMap.locationBlocksTexture); RENDER_BLOCKS.blockAccess = world; Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); tess.setNormal(0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX)); tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord); RENDER_BLOCKS.renderBlockByRenderType(block, tile.xCoord, tile.yCoord, tile.zCoord); tess.setTranslation(0, 0, 0); tess.draw(); GL11.glPopAttrib(); GL11.glPopMatrix(); GL11.glPopMatrix(); } }
Example 18
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 19
Source File: TileEntityRendererMonitorStorageFluid.java From ExtraCells1 with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) { if (tileentity instanceof TileEntityMonitorStorageFluid) { Fluid fluid = ((TileEntityMonitorStorageFluid) tileentity).getFluid(); if (fluid == null || fluid.getIcon() == null) return; Icon fluidIcon = fluid.getFlowingIcon(); GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; ForgeDirection d = ForgeDirection.getOrientation(tileentity.blockMetadata); GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D); GL11.glTranslated(d.offsetX * 0.76D, d.offsetY * 0.76D, d.offsetZ * 0.76D); if (d == ForgeDirection.UP) { GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); } if (d == ForgeDirection.DOWN) { GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } if (d == ForgeDirection.EAST) { GL11.glScalef(-1.0F, -1.0F, -1.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (d == ForgeDirection.WEST) { GL11.glScalef(-1.0F, -1.0F, -1.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (d == ForgeDirection.NORTH) { GL11.glScalef(-1.0F, -1.0F, -1.0F); } if (d == ForgeDirection.SOUTH) { GL11.glScalef(-1.0F, -1.0F, -1.0F); GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } GL11.glTranslatef(0.01F, 0.13F, -0.24F); GL11.glScalef(0.0625F * 0.25F, 0.0625F * 0.25F, 0.01612903F); long qty = ((TileEntityMonitorStorageFluid) tileentity).getAmount(); if (qty > 999999999999L) { qty = 999999999999L; } String msg = Long.toString(qty) + "mB"; if (Extracells.shortenedBuckets) { if (qty > 1000000000L) msg = Long.toString(qty / 1000000000L) + "MegaB"; else if (qty > 1000000L) msg = Long.toString(qty / 1000000L) + "KiloB"; else if (qty > 9999L) { msg = Long.toString(qty / 1000L) + "B"; } } TileEntityMonitorStorageFluid TE = (TileEntityMonitorStorageFluid) tileentity; if (TE.isMachineActive()) { GL11.glTranslated(-8.6F, -16.3, -1.2F); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); Tessellator cake = Tessellator.instance; cake.startDrawingQuads(); cake.setBrightness(255); cake.setColorRGBA_F(1.0f, 1.0f, 1.0f, 1.0f); cake.addVertexWithUV(0, 16, 0, fluidIcon.getMinU(), fluidIcon.getMaxV()); cake.addVertexWithUV(16, 16, 0, fluidIcon.getMaxU(), fluidIcon.getMaxV()); cake.addVertexWithUV(16, 0, 0, fluidIcon.getMaxU(), fluidIcon.getMinV()); cake.addVertexWithUV(0, 0, 0, fluidIcon.getMinU(), fluidIcon.getMinV()); cake.draw(); int width = fr.getStringWidth(msg); GL11.glTranslatef(8.25F - 0.5F * width, 24.0F, 0); GL11.glScaled(1, 0.5, 1); fr.drawString(msg, 0, 0, 0x00FFFF); } GL11.glPopMatrix(); GL11.glPopAttrib(); } }
Example 20
Source File: RenderTileRemoteJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 2 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glPushMatrix(); GL11.glTranslatef(0.45f/2, 0.003f, 0.45f/2); GL11.glScalef(0.55f, 1, 0.55f); TileMirrorRenderer renderer = new TileMirrorRenderer(); renderer.func_147497_a(this.field_147501_a); if(field_147501_a.field_147553_e != null) { renderer.renderTileEntityAt(createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), 0, 0, 0, partialTicks); } GL11.glPopMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef(0.5f, 0.002f, 0.5f); GL11.glRotatef(180, 0, 0, 1); bindTexture(OVERLAY_TEXTURE); GL11.glScalef(1.002f, 1f, 1.002f); GL11.glTranslatef(0, -1.5f, 0); //GL11.glRotatef(180, 1f, 0, 0); MODEL_JAR_POT.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f); GL11.glPopMatrix(); GL11.glPopAttrib(); super.renderTileEntityAt(tile, x, y, z, partialTicks); }