Java Code Examples for net.minecraft.client.renderer.GlStateManager#disableDepth()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#disableDepth() .
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: SurfaceHelper.java From ForgeHax with MIT License | 6 votes |
public static void drawTextAlign(List<String> msgList, int x, int y, int color, double scale, boolean shadow, int alignmask) { GlStateManager.pushMatrix(); GlStateManager.disableDepth(); GlStateManager.scale(scale, scale, scale); final int offsetY = AlignHelper.alignV((int) (getTextHeight() * scale), alignmask); final int height = (int)(getFlowDirY2(alignmask) * (getTextHeight()+1) * scale); final float invScale = (float)(1 / scale); for (int i = 0; i < msgList.size(); i++) { final int offsetX = AlignHelper.alignH((int) (getTextWidth(msgList.get(i)) * scale), alignmask); MC.fontRenderer.drawString( msgList.get(i), (x - offsetX) * invScale, (y - offsetY + height*i) * invScale, color, shadow); } GlStateManager.enableDepth(); GlStateManager.popMatrix(); }
Example 2
Source File: CraftingPatternSelection.java From SkyblockAddons with MIT License | 6 votes |
public void draw() { GlStateManager.disableDepth(); GlStateManager.enableBlend(); Minecraft.getMinecraft().getTextureManager().bindTexture(CraftingPattern.ICONS); GlStateManager.color(1,1,1, 1F); for(CraftingPattern craftingPattern : CraftingPattern.values()) { int offset = getYOffsetByIndex(craftingPattern.index); GlStateManager.color(1,1,1, 1F); mc.ingameGUI.drawTexturedModalRect(x, y+ offset, 0, offset, ICON_SIZE, ICON_SIZE); if(craftingPattern != SkyblockAddons.getInstance().getPersistentValues().getSelectedCraftingPattern()) { GlStateManager.color(1,1,1, .5F); mc.ingameGUI.drawTexturedModalRect(x, y+ offset, 33, 0, ICON_SIZE, ICON_SIZE); } } GlStateManager.disableBlend(); GlStateManager.enableDepth(); blockIncompleteCheckBox.draw(); }
Example 3
Source File: LayoutManager.java From NotEnoughItems with MIT License | 6 votes |
@Override public void renderObjects(GuiContainer gui, int mousex, int mousey) { if (!isHidden()) { layout(gui); if (isEnabled()) { getLayoutStyle().drawBackground(gui); for (Widget widget : drawWidgets) { widget.draw(mousex, mousey); } } else { options.draw(mousex, mousey); } GlStateManager.enableLighting(); GlStateManager.disableDepth(); } else { showItemPanel = false; } }
Example 4
Source File: GuiItemHandlerDestination.java From Signals with GNU General Public License v3.0 | 6 votes |
private static void drawRedCross(int x, int y){ int size = 16; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); GlStateManager.disableTexture2D(); GlStateManager.disableDepth(); GlStateManager.color(1, 0, 0); bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); bufferBuilder.pos(x, y + 1, 0.0D).endVertex(); bufferBuilder.pos(x + size - 1, y + size, 0.0D).endVertex(); bufferBuilder.pos(x + size, y + size - 1, 0.0D).endVertex(); bufferBuilder.pos(x + 1, y, 0.0D).endVertex(); bufferBuilder.pos(x, y + size - 1, 0.0D).endVertex(); bufferBuilder.pos(x + 1, y + size, 0.0D).endVertex(); bufferBuilder.pos(x + size, y + 1, 0.0D).endVertex(); bufferBuilder.pos(x + size - 1, y, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); }
Example 5
Source File: FireRecipeJEI.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { WizardryJEIPlugin.fireCategory.flame.draw(minecraft, 30, 14); if (mouseX >= 30 && mouseX <= 30 + 16 && mouseY >= 14 && mouseY <= 14 + 16) { GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.colorMask(true, true, true, false); drawGradientRect(30, 14, 30 + 16, 14 + 16); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableLighting(); GlStateManager.enableDepth(); } }
Example 6
Source File: GuiComponentItemStackSpinner.java From OpenModsLib with MIT License | 5 votes |
@Override public void renderOverlay(int offsetX, int offsetY, int mouseX, int mouseY) { GL11.glPushMatrix(); GlStateManager.enableDepth(); float scale = 30.0f; GL11.glTranslated(offsetX + x + (scale / 2), offsetY + y + (scale / 2), scale); GL11.glScaled(scale, -scale, scale); rotationY += 0.6f; GL11.glRotatef(20, 1, 0, 0); GL11.glRotatef(rotationY, 0, 1, 0); GlStateManager.color(1, 1, 1); renderItem(stack); GlStateManager.disableDepth(); GL11.glPopMatrix(); }
Example 7
Source File: LitematicaRenderer.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public void renderSchematicOverlay() { boolean invert = Hotkeys.INVERT_OVERLAY_RENDER_STATE.getKeybind().isKeybindHeld(); if (Configs.Visuals.ENABLE_SCHEMATIC_OVERLAY.getBooleanValue() != invert) { boolean renderThrough = Configs.Visuals.SCHEMATIC_OVERLAY_RENDER_THROUGH.getBooleanValue() || Hotkeys.RENDER_OVERLAY_THROUGH_BLOCKS.getKeybind().isKeybindHeld(); float lineWidth = (float) (renderThrough ? Configs.Visuals.SCHEMATIC_OVERLAY_OUTLINE_WIDTH_THROUGH.getDoubleValue() : Configs.Visuals.SCHEMATIC_OVERLAY_OUTLINE_WIDTH.getDoubleValue()); GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.disableCull(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.001F); GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(-0.4f, -0.8f); fi.dy.masa.malilib.render.RenderUtils.setupBlend(); GlStateManager.glLineWidth(lineWidth); fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); if (renderThrough) { GlStateManager.disableDepth(); } this.getWorldRenderer().renderBlockOverlays(); GlStateManager.enableDepth(); GlStateManager.doPolygonOffset(0f, 0f); GlStateManager.disablePolygonOffset(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); } }
Example 8
Source File: AboveHeadRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void render(FontRenderer fontRenderer, LevelheadComponent header, int x) { GlStateManager.disableDepth(); GlStateManager.depthMask(true); GlStateManager.disableDepth(); GlStateManager.depthMask(false); int y = 0; if (header.isRgb()) { fontRenderer.drawString(header.getValue(), x, y, new Color((float) header.getRed() / 255F, (float) header.getGreen() / 255F, (float) header.getBlue() / 255F, .2F).getRGB()); } else if (header.isChroma()) { fontRenderer.drawString(header.getValue(), x, y, Levelhead.getInstance().getDarkRGBColor()); } else { GlStateManager.color(255, 255, 255, .5F); fontRenderer.drawString(header.getColor() + header.getValue(), x, y, Color.WHITE.darker().darker().darker().darker().darker().getRGB() * 255); } GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.color(1.0F, 1.0F, 1.0F); if (header.isRgb()) { GlStateManager.color(header.getRed(), header.getBlue(), header.getGreen(), header.getAlpha()); fontRenderer.drawString(header.getValue(), x, y, new Color(header.getRed(), header.getGreen(), header.getBlue()).getRGB()); } else if (header.isChroma()) { fontRenderer.drawString(header.getValue(), x, y, header.isChroma() ? Levelhead.getInstance().getRGBColor() : 553648127); } else { GlStateManager.color(255, 255, 255, .5F); fontRenderer.drawString(header.getColor() + header.getValue(), x, y, Color.WHITE.darker().getRGB()); } }
Example 9
Source File: RenderEventService.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onRenderWorld(RenderWorldLastEvent event) { GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.disableDepth(); GlStateManager.glLineWidth(1.f); Vec3d renderPos = EntityUtils.getInterpolatedPos(getRenderEntity(), event.getPartialTicks()); RenderEvent e = new RenderEvent(TESSELLATOR, renderPos, event.getPartialTicks()); e.resetTranslation(); MinecraftForge.EVENT_BUS.post(e); GlStateManager.glLineWidth(1.f); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); GlStateManager.enableCull(); GlStateManager.popMatrix(); }
Example 10
Source File: PortalFinderModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void render3D(EventRender3D event) { if (this.mode.getValue() == Mode.THREE_DIMENSIONAL) { final Minecraft mc = Minecraft.getMinecraft(); for (Vec3d portal : this.portals) { GlStateManager.pushMatrix(); final boolean bobbing = mc.gameSettings.viewBobbing; mc.gameSettings.viewBobbing = false; mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); final Vec3d forward = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch)).rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw)); // Line RenderUtil.drawLine3D((float) forward.x, (float) forward.y + mc.player.getEyeHeight(), (float) forward.z, (float) (portal.x - mc.getRenderManager().renderPosX), (float) (portal.y - mc.getRenderManager().renderPosY), (float) (portal.z - mc.getRenderManager().renderPosZ), this.width.getValue(), new Color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f).getRGB()); // Info if (this.showInfo.getValue()) { RenderUtil.glBillboardDistanceScaled((float) portal.x, (float) portal.y, (float) portal.z, mc.player, this.infoScale.getValue()); GlStateManager.disableDepth(); this.drawPortalInfoText(portal, 0, 0); GlStateManager.enableDepth(); } mc.gameSettings.viewBobbing = bobbing; mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); GlStateManager.popMatrix(); } } }
Example 11
Source File: RenderUtils.java From ForgeHax with MIT License | 4 votes |
public static void drawBox( Vec3d startPos, Vec3d endPos, int color, float width, boolean ignoreZ) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); Vec3d renderPos = EntityUtils.getInterpolatedPos(getLocalPlayer(), MC.getRenderPartialTicks()); Vec3d min = startPos.subtract(renderPos); Vec3d max = endPos.subtract(renderPos); double minX = min.x, minY = min.y, minZ = min.z; double maxX = max.x, maxY = max.y, maxZ = max.z; float r = (float) (color >> 16 & 255) / 255.0F; float g = (float) (color >> 8 & 255) / 255.0F; float b = (float) (color & 255) / 255.0F; float a = (float) (color >> 24 & 255) / 255.0F; GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.glLineWidth(width); if (ignoreZ) { GlStateManager.disableDepth(); } GlStateManager.color(r, g, b, a); // GlStateManager.translate(startPos.xCoord, startPos.yCoord, startPos.zCoord); buffer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); buffer.pos(minX, minY, minZ).endVertex(); buffer.pos(maxX, minY, minZ).endVertex(); buffer.pos(maxX, minY, maxZ).endVertex(); buffer.pos(minX, minY, maxZ).endVertex(); buffer.pos(minX, minY, minZ).endVertex(); tessellator.draw(); buffer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); buffer.pos(minX, maxY, minZ).endVertex(); buffer.pos(maxX, maxY, minZ).endVertex(); buffer.pos(maxX, maxY, maxZ).endVertex(); buffer.pos(minX, maxY, maxZ).endVertex(); buffer.pos(minX, maxY, minZ).endVertex(); tessellator.draw(); buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); buffer.pos(minX, minY, minZ).endVertex(); buffer.pos(minX, maxY, minZ).endVertex(); buffer.pos(maxX, minY, minZ).endVertex(); buffer.pos(maxX, maxY, minZ).endVertex(); buffer.pos(maxX, minY, maxZ).endVertex(); buffer.pos(maxX, maxY, maxZ).endVertex(); buffer.pos(minX, minY, maxZ).endVertex(); buffer.pos(minX, maxY, maxZ).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); GlStateManager.enableCull(); GlStateManager.popMatrix(); }
Example 12
Source File: ModularUIGui.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.hoveredSlot = null; drawDefaultBackground(); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.disableDepth(); drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(guiLeft, guiTop, 0.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i) { Slot slot = this.inventorySlots.inventorySlots.get(i); if (slot.isEnabled()) { this.drawSlotContents(slot); } if (isPointInRegion(slot.xPos, slot.yPos, 16, 16, mouseX, mouseY) && slot.isEnabled()) { renderSlotOverlay(slot); setHoveredSlot(slot); } } RenderHelper.disableStandardItemLighting(); GlStateManager.popMatrix(); drawGuiContainerForegroundLayer(mouseX, mouseY); GlStateManager.pushMatrix(); GlStateManager.translate(guiLeft, guiTop, 0.0F); RenderHelper.enableGUIStandardItemLighting(); MinecraftForge.EVENT_BUS.post(new GuiContainerEvent.DrawForeground(this, mouseX, mouseY)); GlStateManager.enableDepth(); renderItemStackOnMouse(mouseX, mouseY); renderReturningItemStack(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); renderHoveredToolTip(mouseX, mouseY); }
Example 13
Source File: GuiCustomButton.java From Custom-Main-Menu with MIT License | 4 votes |
protected void drawHoveringText(Minecraft mc, List textLines, int x, int y, FontRenderer font) { if (!textLines.isEmpty()) { int width = mc.currentScreen.width; int height = mc.currentScreen.height; GlStateManager.disableDepth(); int k = 0; Iterator iterator = textLines.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); int l = font.getStringWidth(s); if (l > k) { k = l; } } int j2 = x + 12; int k2 = y - 12; int i1 = 8; if (textLines.size() > 1) { i1 += 2 + (textLines.size() - 1) * 10; } if (j2 + k > width) { j2 -= 28 + k; } if (k2 + i1 + 6 > height) { k2 = this.height - i1 - 6; } this.zLevel = 300.0F; int j1 = -267386864; this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1); this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1); this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1); this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1); this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1); int k1 = 1347420415; int l1 = (k1 & 16711422) >> 1 | k1 & -16777216; this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1); this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1); this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1); this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1); for (int i2 = 0; i2 < textLines.size(); ++i2) { String s1 = (String) textLines.get(i2); font.drawStringWithShadow(s1, j2, k2, -1); if (i2 == 0) { k2 += 2; } k2 += 10; } this.zLevel = 0.0F; GlStateManager.enableDepth(); } }
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); } this.drawSelectionBox(k, l + 2, mouseXIn, mouseYIn + 2); 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((double) this.left, (double) (this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos((double) this.right, (double) (this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos((double) this.right, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos((double) this.left, (double) 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((double) this.left, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos((double) this.right, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos((double) this.right, (double) (this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos((double) this.left, (double) (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((double) i, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos((double) j, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos((double) j, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos((double) i, (double) 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((double) i, (double) (l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos((double) j, (double) (l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos((double) j, (double) l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos((double) i, (double) 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((double) i, (double) (l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos((double) (j - 1), (double) (l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos((double) (j - 1), (double) l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos((double) i, (double) 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: FontUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public static void drawItemQuantity(int x, int y, ItemStack item, String quantity, int mode) { if(item == null || (quantity == null && item.stackSize <= 1)) return; if(quantity == null) { switch(mode) { case 2: int q = item.stackSize; String postfix = ""; for(int p = 0; p < 3 && q > 1000; p++) { q/=1000; postfix = prefixes[p]; } quantity = Integer.toString(q)+postfix; break; case 1: quantity = ""; if(item.stackSize/64 > 0) quantity+=item.stackSize/64 + "s"; if(item.stackSize%64 > 0) quantity+=item.stackSize%64; break; default: quantity = Integer.toString(item.stackSize); break; } } double scale = quantity.length() > 2 ? 0.5 : 1; double sheight = 8*scale; double swidth = fontRenderer.getStringWidth(quantity)*scale; GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.pushMatrix(); GlStateManager.translate(x + 16 - swidth, y + 16 - sheight, 0); GlStateManager.scale(scale, scale, 1); fontRenderer.drawStringWithShadow(quantity, 0, 0, 0xFFFFFF); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.enableDepth(); }
Example 16
Source File: WrapperGlStateManager.java From ClientBase with MIT License | 4 votes |
public static void disableDepth() { GlStateManager.disableDepth(); }
Example 17
Source File: ProjectilesModule.java From seppuku with GNU General Public License v3.0 | 4 votes |
@Listener public void onRender(EventRender3D event) { final Minecraft mc = Minecraft.getMinecraft(); ThrowableType throwingType = this.getTypeFromCurrentItem(mc.player); if (throwingType == ThrowableType.NONE) { return; } FlightPath flightPath = new FlightPath(mc.player, throwingType); while (!flightPath.isCollided()) { flightPath.onUpdate(); flightPoint.offer(new Vec3d(flightPath.position.x - mc.getRenderManager().viewerPosX, flightPath.position.y - mc.getRenderManager().viewerPosY, flightPath.position.z - mc.getRenderManager().viewerPosZ)); } final boolean bobbing = mc.gameSettings.viewBobbing; mc.gameSettings.viewBobbing = false; mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.shadeModel(GL_SMOOTH); glLineWidth(width.getValue()); glEnable(GL_LINE_SMOOTH); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); GlStateManager.disableDepth(); glEnable(GL32.GL_DEPTH_CLAMP); final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferbuilder = tessellator.getBuffer(); while (!flightPoint.isEmpty()) { bufferbuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); Vec3d head = flightPoint.poll(); bufferbuilder.pos(head.x, head.y, head.z).color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f, alpha.getValue() / 255.0f).endVertex(); if (flightPoint.peek() != null) { Vec3d point = flightPoint.peek(); bufferbuilder.pos(point.x, point.y, point.z).color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f, alpha.getValue() / 255.0f).endVertex(); } tessellator.draw(); } GlStateManager.shadeModel(GL_FLAT); glDisable(GL_LINE_SMOOTH); GlStateManager.enableDepth(); glDisable(GL32.GL_DEPTH_CLAMP); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); mc.gameSettings.viewBobbing = bobbing; mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); if (flightPath.collided) { final RayTraceResult hit = flightPath.target; AxisAlignedBB bb = null; if (hit.typeOfHit == RayTraceResult.Type.BLOCK) { final BlockPos blockpos = hit.getBlockPos(); final IBlockState iblockstate = mc.world.getBlockState(blockpos); if (iblockstate.getMaterial() != Material.AIR && mc.world.getWorldBorder().contains(blockpos)) { final Vec3d interp = MathUtil.interpolateEntity(mc.player, mc.getRenderPartialTicks()); bb = iblockstate.getSelectedBoundingBox(mc.world, blockpos).grow(0.0020000000949949026D).offset(-interp.x, -interp.y, -interp.z); } } else if (hit.typeOfHit == RayTraceResult.Type.ENTITY && hit.entityHit != null) { final AxisAlignedBB entityBB = hit.entityHit.getEntityBoundingBox(); if (entityBB != null) { bb = new AxisAlignedBB(entityBB.minX - mc.getRenderManager().viewerPosX, entityBB.minY - mc.getRenderManager().viewerPosY, entityBB.minZ - mc.getRenderManager().viewerPosZ, entityBB.maxX - mc.getRenderManager().viewerPosX, entityBB.maxY - mc.getRenderManager().viewerPosY, entityBB.maxZ - mc.getRenderManager().viewerPosZ); } } if (bb != null) { RenderUtil.drawBoundingBox(bb, width.getValue(), red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f, alpha.getValue() / 255.0f); } } }
Example 18
Source File: GuiEntityRender.java From WearableBackpacks with MIT License | 4 votes |
@Override public void draw(int mouseX, int mouseY, float partialTicks) { int w = getWidth(); int h = getHeight(); enableBlendAlphaStuffs(); setRenderColorARGB(_colorBackground); drawRect(1, 1, w - 2, h - 2); setRenderColorARGB(_colorBorder); drawOutline(0, 0, w, h); disableBlendAlphaStuffs(); Entity entity = getEntity(); if (entity == null) return; AxisAlignedBB bbox = entity.getRenderBoundingBox(); float entityWidth = (float)(bbox.maxX - bbox.minX); float entityHeight = (float)(bbox.maxY - bbox.minY); float scale = Math.min((w - RESERVED_SPACE) / entityWidth, (h - RESERVED_SPACE) / entityHeight) * _zoom; float yaw = _yawDefault + _yaw; float pitch = _pitchDefault + _pitch; getContext().pushScissor(this, 1, 1, w - 2, h - 2); if (entity.getEntityWorld() == null) entity.setWorld(DummyWorld.INSTANCE); if (getMC().player == null) { World world = entity.getEntityWorld(); if (!(world instanceof DummyWorld)) return; getMC().player = ((DummyWorld)world).player; getMC().player.setWorld(world); } setRenderColorARGB(Color.WHITE); GlStateManager.enableDepth(); // From GuiInventory.drawEntityOnScreen GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(w * _centerX, h * _centerY, 100.0F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(pitch, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0.0F, -(entityHeight / 2), 0.0F); GlStateManager.rotate(yaw, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.disableDepth(); if (getMC().player instanceof DummyPlayerSP) getMC().player = null; getContext().popScissor(); }
Example 19
Source File: YeetHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
@InvokeEvent public void render(RenderEntitiesEvent event) { for (Yeet yeet : yeets) { RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); FontRenderer fontrenderer = renderManager.getFontRenderer(); float f = 1.6F; float f1 = 0.016666668F * f; GlStateManager.pushMatrix(); EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer; float partialTicks = event.getPartialTicks(); double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks; EntityPlayer sender = yeet.sender; if (sender == null) continue; double e0 = yeet.sender.lastTickPosX + (yeet.sender.posX - yeet.sender.lastTickPosX) * (double) partialTicks; double e1 = yeet.sender.lastTickPosY + (yeet.sender.posY - yeet.sender.lastTickPosY) * (double) partialTicks; double e2 = yeet.sender.lastTickPosZ + (yeet.sender.posZ - yeet.sender.lastTickPosZ) * (double) partialTicks; GlStateManager.translate(e0 - d0, e1 - d1, e2 - d2); GlStateManager.translate(0, 3, 0); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); int xMultiplier = 1; // Nametag x rotations should flip in front-facing 3rd person if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().gameSettings != null && Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) { xMultiplier = -1; } GlStateManager.rotate(renderManager.playerViewX * xMultiplier, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = 0; String string = "YEET"; int j = fontrenderer.getStringWidth(string) / 2; GlStateManager.disableTexture2D(); GlStateManager.scale(4, 4, 4); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(string, -j, 0, 16777215, true); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } }
Example 20
Source File: GuiContainerManager.java From NotEnoughItems with MIT License | 4 votes |
public static void enable2DRender() { GlStateManager.disableLighting(); GlStateManager.disableDepth(); }