Java Code Examples for net.minecraft.client.renderer.ItemRenderer#renderItemIn2D()

The following examples show how to use net.minecraft.client.renderer.ItemRenderer#renderItemIn2D() . 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: RenderGolemHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
    GL11.glPushMatrix();

    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
    GL11.glScaled(0.175D, 0.175D, 0.175D);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    ItemStack coreItem = core.getItem();
    IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMinU();
    float f4 = icon.getMaxV();
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);

    GL11.glPopMatrix();
}
 
Example 2
Source File: PlayerSpecials.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderExtras(EntityPlayer player, boolean post) {
	if (!post) {
		GL11.glPushMatrix();
		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
		if (player.isSneaking()) {
			GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
		}
		boolean armor = player.getCurrentArmor(1) != null;
		GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
		GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
		GL11.glTranslatef(-0.25F, -0.85F, armor ? 0.2F : 0.28F);
		GL11.glScalef(0.5F, 0.5F, 0.5F);
		GL11.glColor3f(1.0F, 1.0F, 1.0F);
		int light = 0xF000F0;
		int lightmapX = light % 0x10000;
		int lightmapY = light / 0x10000;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);

		IIcon icon = toRender.getIconIndex();
		ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1.0F / 16.0F);
		GL11.glPopMatrix();
	}
}
 
Example 3
Source File: RenderGolemHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void renderCarriedItemsFix(EntityGolemBase golem) {
    GL11.glPushMatrix();

    GL11.glScaled(0.4D, 0.4D, 0.4D);

    GL11.glTranslatef(-0.5F, 2.5F, -1.25F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);

    ItemStack item = golem.getCarriedForDisplay();

    int renderPass = 0;
    do {
        IIcon icon = item.getItem().getIcon(item, renderPass);
        if (icon != null) {
            Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
            GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());

            ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        renderPass++;
    } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));

    GL11.glPopMatrix();
}
 
Example 4
Source File: BW_GT_ItemRenderer.java    From bartworks with MIT License 4 votes vote down vote up
@Override
    public void renderItem(IItemRenderer.ItemRenderType type, ItemStack aStack, Object... data) {
        if (!GT_Utility.isStackInvalid(aStack)) {
            short aMetaData = (short) aStack.getItemDamage();
            if (aMetaData >= 0) {
                BW_Meta_Items.BW_GT_MetaGen_Item_Hook aItem = (BW_Meta_Items.BW_GT_MetaGen_Item_Hook) aStack.getItem();
                GL11.glEnable(3042);
                if (type == IItemRenderer.ItemRenderType.ENTITY) {
                    if (RenderItem.renderInFrame) {
                        GL11.glScalef(0.85F, 0.85F, 0.85F);
                        GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
                    }
                    GL11.glTranslated(-0.5D, -0.42D, 0.0D);
                }

                GL11.glColor3f(1.0F, 1.0F, 1.0F);
                IIcon tIcon = (IIcon) BW_Util.get2DCoordFrom1DArray(aMetaData, 0, 2, aItem.mIconList);

                Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
                GL11.glBlendFunc(770, 771);
                if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
                    if (aMetaData < CircuitImprintLoader.reverseIDs)
                        GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
                    else {
                        for (int i = 0; i < 4; i++) {
                            GT_RenderUtil.renderItemIcon(tIcon, 0.0D+i*2D,0.0D+i*2D,10.0D+i*2D,10.0D+i*2D, 0.001D, 0.0F, 0.0F, -1.0F);
                        }
                    }
                } else {
                    if (aMetaData < CircuitImprintLoader.reverseIDs)
                        ItemRenderer.renderItemIn2D(Tessellator.instance,tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F);
//                    else {
//                        for (int i = 0; i < 4; i++) {
//                            ItemRenderer.renderItemIn2D(Tessellator.instance, 0.0F+i*2F,0.0F+i*2F,10.0F+i*2F,10.0F+i*2F, tIcon.getIconWidth(), tIcon.getIconHeight(),0.0625F);
//                        }
//                    }
//                    ItemRenderer.renderItemIn2D(Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F);
                }

                IIcon tOverlay = (IIcon) BW_Util.get2DCoordFrom1DArray(aMetaData, 1, 2, aItem.mIconList);
                GL11.glColor3f(1.0F, 1.0F, 1.0F);
                if (tOverlay != null) {
                    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
                    GL11.glBlendFunc(770, 771);
                    if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
                        GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
                    } else {
                        ItemRenderer.renderItemIn2D(Tessellator.instance, tOverlay.getMaxU(), tOverlay.getMinV(), tOverlay.getMinU(), tOverlay.getMaxV(), tOverlay.getIconWidth(), tOverlay.getIconHeight(), 0.0625F);
                    }
                }
            }

            GL11.glDisable(3042);
        }
    }