Java Code Examples for net.minecraft.client.renderer.entity.RenderItem#renderItemAndEffectIntoGUI()

The following examples show how to use net.minecraft.client.renderer.entity.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: ItemIcon.java    From OpenPeripheral-Addons with MIT License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
protected void drawContents(RenderState renderState, float partialTicks) {
	renderState.enableTexture();
	renderState.enableDepthTest();
	renderState.enableCullFace();
	renderState.disableLight();
	renderState.setColor(0xFFFFFF, 1.0f);

	GL11.glScalef(scale, scale, scale);
	final RenderItem renderItem = getRenderItem();
	final Minecraft minecraft = Minecraft.getMinecraft();
	final TextureManager textureManager = minecraft.getTextureManager();

	renderItem.renderItemAndEffectIntoGUI(minecraft.fontRenderer, textureManager, drawStack, 0, 0);

	if (damageBar > 0 || !Strings.isNullOrEmpty(label)) {
		renderItem.renderItemOverlayIntoGUI(minecraft.fontRenderer, textureManager, dummyStack, 0, 0, label);
	}

	RenderUtils.disableLightmap();

	renderState.readState();
}
 
Example 2
Source File: ElementRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void render(List<ItemStack> itemStacks, int x, double y, boolean showDurability) {
    GlStateManager.pushMatrix();
    int line = 0;
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();

    for (ItemStack stack : itemStacks) {
        if (stack.getMaxDamage() == 0) continue;
        String dur = stack.getMaxDamage() - stack.getItemDamage() + "";
        renderItem.renderItemAndEffectIntoGUI(stack, (int) (x / ElementRenderer.getCurrentScale() - (current.isRightSided() ? (showDurability ? currentScale + fontRendererObj.getStringWidth(dur) : -8) : 0)), (int) ((y + (16 * line * ElementRenderer.getCurrentScale())) / ElementRenderer.getCurrentScale()));
        if (showDurability) ElementRenderer.draw((int) (x + (double) 20 * currentScale), y + (16 * line) + 4, dur);
        line++;
    }

    GlStateManager.popMatrix();
}