net.minecraft.client.renderer.RenderItem Java Examples
The following examples show how to use
net.minecraft.client.renderer.RenderItem.
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: 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 #2
Source File: RenderHelper.java From HoloInventory with MIT License | 6 votes |
public static void renderStack(RenderItem ri, ItemStack stack, int cols, int col, int rows, int row) { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); GlStateManager.translate(0.4f * (cols / 2.0 - col) - 0.2f, 0.4f * (rows / 2.0 - row), 0); GlStateManager.pushMatrix(); GlStateManager.rotate((float) (360.0 * (double) (System.currentTimeMillis() & 0x3FFFL) / (double) 0x3FFFL), 0, 1, 0); GlStateManager.scale(0.45, 0.45, 0.45); ri.renderItem(stack, ItemCameraTransforms.TransformType.FIXED); if (stack.hasEffect()) { GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); } GlStateManager.popMatrix(); GlStateManager.popAttrib(); GlStateManager.popMatrix(); }
Example #3
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 #4
Source File: GuiComponentItemStackSpinner.java From OpenModsLib with MIT License | 6 votes |
private void renderItem(ItemStack itemStack) { parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); final RenderItem itemRenderer = parent.getItemRenderer(); final ItemModelMesher itemModelMesher = itemRenderer.getItemModelMesher(); final IBakedModel model = itemModelMesher.getItemModel(stack); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.pushMatrix(); itemRenderer.renderItem(stack, model); GlStateManager.cullFace(CullFace.BACK); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); GlStateManager.enableLighting(); }
Example #5
Source File: ModelPortableBarrel.java From BetterChests with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void render(ItemStack stack, float patrtialTicks) { GlStateManager.pushMatrix(); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.renderItem(stack, parent); InventoryBPortableBarrel barrel = BlocksItemsBetterChests.betterportablebarrel.getInventoryFor(stack, null); if (barrel != null && barrel.getChestPart().isItemSet()) { InventoryPartBarrel part = barrel.getChestPart(); GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, -0.05); GlStateManager.scale(0.8, 0.8, 0.8); renderItem.renderItem(part.getDummy(), TransformType.FIXED); GlStateManager.enableBlend(); GlStateManager.popMatrix(); } GlStateManager.popMatrix(); }
Example #6
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 #7
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 #8
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 #9
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 #10
Source File: FacadeRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static void renderItemCover(CCRenderState ccrs, int side, ItemStack renderStack, Cuboid6 bounds) { Minecraft minecraft = Minecraft.getMinecraft(); RenderItem renderItem = minecraft.getRenderItem(); IBakedModel model = renderItem.getItemModelWithOverrides(renderStack, null, null); IBlockState state = FacadeHelper.lookupBlockForItem(renderStack); String cacheKey = state.getBlock().getRegistryName() + "|" + state.getBlock().getMetaFromState(state); List<CCQuad> renderQuads = itemQuadCache.getIfPresent(cacheKey); if (renderQuads == null) { List<BakedQuad> quads = new ArrayList<>(model.getQuads(null, null, 0)); for (EnumFacing face : EnumFacing.VALUES) { quads.addAll(model.getQuads(null, face, 0)); } renderQuads = applyItemTint(sliceQuads(CCQuad.fromArray(quads), side, bounds), renderStack); itemQuadCache.put(cacheKey, renderQuads); } AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs); consumer.setTranslation(new Matrix4() .translate(Vector3.center.copy().subtract(bounds.center())) .scale(1.05, 1.05, 1.05)); for (CCQuad quad : renderQuads) { quad.pipe(consumer); } }
Example #11
Source File: ItemPanel.java From NotEnoughItems with MIT License | 5 votes |
@Override public void postDraw(int mousex, int mousey) { if (!draggedStack.isEmpty()) { RenderItem drawItems = GuiHelper.getRenderItem(); drawItems.zLevel += 100; GuiHelper.drawItem(mousex - 8, mousey - 8, draggedStack); drawItems.zLevel -= 100; } }
Example #12
Source File: ClientProxy.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@Override public void init(FMLInitializationEvent e) { super.init(e); registerBlockItem(ValkyrienSkiesMod.INSTANCE.physicsInfuser); registerBlockItem(ValkyrienSkiesMod.INSTANCE.physicsInfuserCreative); // registerItemModel(ValkyrienSkiesMod.INSTANCE.physicsCore); RenderItem renderItem = Minecraft.getMinecraft() .getRenderItem(); renderItem.getItemModelMesher() .register(ValkyrienSkiesMod.INSTANCE.physicsCore, 0, new ModelResourceLocation(ValkyrienSkiesMod.MOD_ID + ":testmodel", "inventory")); }
Example #13
Source File: ClientProxy.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
private static void registerItemModel(Item toRegister) { RenderItem renderItem = Minecraft.getMinecraft() .getRenderItem(); renderItem.getItemModelMesher() .register(toRegister, 0, new ModelResourceLocation( ValkyrienSkiesMod.MOD_ID + ":" + toRegister.getTranslationKey() .substring(5), "inventory")); }
Example #14
Source File: ClientProxyControl.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
private static void registerItemModel(Item toRegister) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); ModelResourceLocation modelResourceLocation = new ModelResourceLocation( ValkyrienSkiesControl.MOD_ID + ":" + toRegister.getTranslationKey() .substring(5), "inventory"); renderItem.getItemModelMesher() .register(toRegister, 0, modelResourceLocation); }
Example #15
Source File: TextureHelper.java From malmo with MIT License | 4 votes |
public MalmoRenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn) { super(renderEngineIn, itemRendererIn); }
Example #16
Source File: GuiHelper.java From NotEnoughItems with MIT License | 4 votes |
public static RenderItem getRenderItem() { return Minecraft.getMinecraft().getRenderItem(); }
Example #17
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(); }
Example #18
Source File: ClientProxyWorld.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
private void registerItemModel(Item toRegister) { RenderItem renderItem = Minecraft.getMinecraft() .getRenderItem(); renderItem.getItemModelMesher() .register(toRegister, 0, new ModelResourceLocation( ValkyrienSkiesWorld.MOD_ID + ":" + toRegister.getTranslationKey() .substring(5), "inventory")); }
Example #19
Source File: RenderEntityThrownItem.java From Production-Line with MIT License | 4 votes |
public RenderEntityThrownItem(RenderManager renderManagerIn, RenderItem itemRendererIn) { super(renderManagerIn); this.itemRenderer = itemRendererIn; }
Example #20
Source File: RendererItem.java From AdvancedRocketry with MIT License | 4 votes |
public RendererItem(RenderManager renderManagerIn, RenderItem p_i46167_2_) { super(renderManagerIn); itemRenderer = new RenderEntityItem(renderManagerIn, p_i46167_2_); }
Example #21
Source File: AgriGuiWrapper.java From AgriCraft with MIT License | 4 votes |
public RenderItem getItemRender() { return itemRender; }
Example #22
Source File: RenderEntityOwlEgg.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
public RenderEntityOwlEgg(RenderManager renderManagerIn, RenderItem itemRendererIn) { super(renderManagerIn, EnderZoo.itemOwlEgg, itemRendererIn); }
Example #23
Source File: ItemFireSword.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
public static void registerRenders() { ModelResourceLocation model = new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(INSTANCE, 0, model); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(INSTANCE, 0, new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory")); }
Example #24
Source File: DynamiteRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
public DynamiteRenderer(RenderManager renderManagerIn, RenderItem itemRendererIn) { super(renderManagerIn, MetaItems.DYNAMITE.getMetaItem(), itemRendererIn); }
Example #25
Source File: ItemObsidianSword.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
public static void registerRenders() { ModelResourceLocation model = new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(INSTANCE, 0, model); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(INSTANCE, 0, new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory")); }
Example #26
Source File: ItemToroLeather.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
public static void registerRenders() { ModelResourceLocation model = new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(INSTANCE, 0, model); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(INSTANCE, 0, new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory")); }
Example #27
Source File: ItemBattleAxe.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
public static void registerRenders() { ModelResourceLocation model = new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(INSTANCE, 0, model); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(INSTANCE, 0, new ModelResourceLocation(ToroQuest.MODID + ":" + NAME, "inventory")); }
Example #28
Source File: IComponentParent.java From OpenModsLib with MIT License | votes |
public RenderItem getItemRenderer();