Java Code Examples for net.minecraft.client.renderer.RenderItem#renderItemAndEffectIntoGUI()
The following examples show how to use
net.minecraft.client.renderer.RenderItem#renderItemAndEffectIntoGUI() .
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: GuiFabricatorButton.java From EmergingTechnology with MIT License | 6 votes |
@SideOnly(Side.CLIENT) @Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { if (!visible) return; RenderHelper.enableGUIStandardItemLighting(); RenderItem itemRender = mc.getRenderItem(); GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; itemRender.zLevel = 200.0F; itemRender.renderItemAndEffectIntoGUI(itemStackToRender, x, y); this.zLevel = 0.0F; itemRender.zLevel = 0.0F; RenderHelper.disableStandardItemLighting(); }
Example 2
Source File: Widget.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) protected static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable String altTxt) { GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 0.0F, 32.0F); GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.enableRescaleNormal(); GlStateManager.enableLighting(); RenderHelper.enableGUIStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f); Minecraft mc = Minecraft.getMinecraft(); RenderItem itemRender = mc.getRenderItem(); itemRender.renderItemAndEffectIntoGUI(itemStack, x, y); itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, altTxt); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.popMatrix(); GlStateManager.enableBlend(); GlStateManager.disableDepth(); }
Example 3
Source File: PuzzleTESR.java From YouTubeModdingTutorial with MIT License | 6 votes |
private void renderSlot(TilePuzzle te) { ItemStack stack = te.getItem(); if (stack.isEmpty()) { return; } RenderHelper.enableGUIStandardItemLighting(); float factor = 4.0f; float f3 = 0.0075F; GlStateManager.translate(-0.5F, 0.5F, -0.15F); GlStateManager.scale(f3 * factor, -f3 * factor, 0.0001f); RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); itemRender.renderItemAndEffectIntoGUI(stack, 8, 8); RenderHelper.enableStandardItemLighting(); }
Example 4
Source File: BaseComponent.java From OpenModsLib with MIT License | 6 votes |
protected void drawItemStack(@Nonnull ItemStack stack, int x, int y, String overlayText) { if (stack.isEmpty()) return; RenderHelper.enableGUIStandardItemLighting(); final RenderItem itemRenderer = parent.getItemRenderer(); GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; itemRenderer.zLevel = 200.0F; FontRenderer font = null; font = stack.getItem().getFontRenderer(stack); if (font == null) font = parent.getFontRenderer(); itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); itemRenderer.renderItemOverlayIntoGUI(font, stack, x, y, overlayText); this.zLevel = 0.0F; itemRenderer.zLevel = 0.0F; RenderHelper.disableStandardItemLighting(); }
Example 5
Source File: GuiHelper.java From NotEnoughItems with MIT License | 5 votes |
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) { enable3DRender(); RenderItem drawItems = getRenderItem(); float zLevel = drawItems.zLevel += 100F; try { drawItems.renderItemAndEffectIntoGUI(itemstack, i, j); drawItems.renderItemOverlays(fontRenderer, itemstack, i, j); if (!checkMatrixStack()) { throw new IllegalStateException("Modelview matrix stack too deep"); } if (Tessellator.getInstance().getBuffer().isDrawing) { throw new IllegalStateException("Still drawing"); } } catch (Exception e) { LogHelper.errorOnce(e, itemstack.toString(), "Error whilst rendering: " + itemstack); restoreMatrixStack(); if (Tessellator.getInstance().getBuffer().isDrawing) { Tessellator.getInstance().draw(); } drawItems.zLevel = zLevel; drawItems.renderItemIntoGUI(new ItemStack(Blocks.STONE), i, j); } enable2DRender(); drawItems.zLevel = zLevel - 100; }
Example 6
Source File: BaseComponent.java From OpenModsLib with MIT License | 5 votes |
protected void drawItemStack(@Nonnull ItemStack stack, int x, int y) { if (stack.isEmpty()) return; RenderHelper.enableGUIStandardItemLighting(); final RenderItem itemRenderer = parent.getItemRenderer(); GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; itemRenderer.zLevel = 200.0F; itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); this.zLevel = 0.0F; itemRenderer.zLevel = 0.0F; RenderHelper.disableStandardItemLighting(); }
Example 7
Source File: RenderCodex.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
public void renderItemStack(ItemStack stack) { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); itemRender.renderItemAndEffectIntoGUI(stack, 0, 0); GlStateManager.translate(0, 0, 150); FontRenderer font = stack.getItem().getFontRenderer(stack); if (font == null) font = Minecraft.getMinecraft().fontRenderer; if (font != null && stack.getCount() != 1) { GlStateManager.translate(0, 0, 5); GlStateManager.disableLighting(); GlStateManager.disableBlend(); font.drawStringWithShadow(stack.getCount() + "", 17F - font.getStringWidth(stack.getCount() + ""), 9F, 0xFFFFFF); GlStateManager.enableDepth(); GlStateManager.enableBlend(); GlStateManager.translate(0, 0, -5); } if (stack.getItem().showDurabilityBar(stack)) { GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); double health = stack.getItem().getDurabilityForDisplay(stack); int rgbfordisplay = stack.getItem().getRGBDurabilityForDisplay(stack); int i = Math.round(13.0F - (float) health * 13.0F); draw(bufferbuilder, 2, 13, 13, 2, 0, 0, 0, 255); draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, rgbfordisplay & 255, 255); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); } EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player; float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks()); if (f3 > 0.0F) { GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); Tessellator tessellator1 = Tessellator.getInstance(); BufferBuilder bufferbuilder1 = tessellator1.getBuffer(); this.draw(bufferbuilder1, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, 255, 255, 127); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); } GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.disableRescaleNormal(); }