Java Code Examples for net.minecraftforge.client.IItemRenderer#ItemRenderType

The following examples show how to use net.minecraftforge.client.IItemRenderer#ItemRenderType . 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: ThaumcraftCandleSource.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta) {
    RenderHelper renderHelper = RenderHelper.instance;

    renderHelper.setRenderBounds(0.375, 0, 0.375, 0.625, 0.5, 0.625);
    renderHelper.renderFace(RenderHelper.ZNEG, null, blockCandle, blockCandle.getIcon(2, meta), meta);
    renderHelper.renderFace(RenderHelper.ZPOS, null, blockCandle, blockCandle.getIcon(3, meta), meta);
    renderHelper.renderFace(RenderHelper.XNEG, null, blockCandle, blockCandle.getIcon(4, meta), meta);
    renderHelper.renderFace(RenderHelper.XPOS, null, blockCandle, blockCandle.getIcon(5, meta), meta);
    renderHelper.renderFace(RenderHelper.YPOS, null, blockCandle, blockCandle.getIcon(1, meta), meta);

    renderHelper.setRenderBounds(0.46875, 0, 0.46875, 0.5325, 1, 0.53125);
    renderHelper.renderFace(RenderHelper.ZNEG, null, Blocks.torch, Blocks.torch.getIcon(2, 0), meta);
    renderHelper.renderFace(RenderHelper.ZPOS, null, Blocks.torch, Blocks.torch.getIcon(3, 0), meta);
    renderHelper.renderFace(RenderHelper.XNEG, null, Blocks.torch, Blocks.torch.getIcon(4, 0), meta);
    renderHelper.renderFace(RenderHelper.XPOS, null, Blocks.torch, Blocks.torch.getIcon(5, 0), meta);
    renderHelper.setRenderBounds(0.46875, 0, 0.46875, 0.5325, 0.625, 0.5325);
    renderHelper.renderFace(RenderHelper.YPOS, null, Blocks.torch, Blocks.torch.getIcon(1, 0), meta);
}
 
Example 2
Source File: ItemNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) {
    if (type == IItemRenderer.ItemRenderType.ENTITY) {
        GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
    } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
        GL11.glTranslatef(0.0F, 0.0F, -0.5F);
    }
    TileNode tjf = new TileNode();
    tjf.setAspects(aspects);
    tjf.setNodeType(nodeType);
    tjf.blockType = ConfigBlocks.blockAiry;
    tjf.blockMetadata = 0;
    GL11.glPushMatrix();
    GL11.glTranslated(0.5D, 0.5D, 0.5D);
    GL11.glScaled(2.0D, 2.0D, 2.0D);
    renderItemNode(tjf);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    renderItemNode(tjf);
    GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    renderItemNode(tjf);
    GL11.glPopMatrix();
    GL11.glEnable(32826);
}
 
Example 3
Source File: ItemWrapperMethods.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
default void renderItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
	Item item = ItemConverter.instance().toNova(itemStack);
	if (item.components.has(Renderer.class)) {
		GL11.glPushAttrib(GL_TEXTURE_BIT);
		GL11.glEnable(GL12.GL_RESCALE_NORMAL);
		GL11.glPushMatrix();
		Tessellator.instance.startDrawingQuads();
		BWModel model = new BWModel();
		model.matrix.rotate(Direction.UP.toVector(), 1 / 4 * Math.PI);
		model.matrix.rotate(Direction.EAST.toVector(), 1 / 6 * Math.PI);
		model.matrix.scale(1.6, 1.6, 1.6);
		item.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
		model.render();
		Tessellator.instance.draw();
		GL11.glPopMatrix();
		GL11.glPopAttrib();
	}
}
 
Example 4
Source File: ItemRenderRemoteJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    AspectList aspects = ((ItemJarFilled)ConfigItems.itemJarFilled).getAspects(stack);
    if(aspects != null) {
        tile.aspect = aspects.getAspects()[0];
        tile.amount = aspects.getAmount(tile.aspect);
    } else {
        tile.aspect = null;
        tile.amount = 0;
    }

    if(stack.hasTagCompound()) {
        tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId");
    }

    super.renderItem(type, stack, data);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.5f, 0.5f, 0.5f);

    RenderingRegistry.instance().renderInventoryBlock(RenderBlocks.getInstance(), RegisteredBlocks.blockRemoteJar, 0, RegisteredBlocks.blockRemoteJar.getRenderType());
    GL11.glPopMatrix();
}
 
Example 5
Source File: BW_GT_ItemRenderer.java    From bartworks with MIT License 5 votes vote down vote up
@Override
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType aType, ItemStack aStack, IItemRenderer.ItemRendererHelper aHelper) {
    if (GT_Utility.isStackInvalid(aStack)) {
        return false;
    } else {
        return aType == IItemRenderer.ItemRenderType.ENTITY;
    }
}
 
Example 6
Source File: VanillaLanternSource.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta) {
    RenderHelper renderHelper = RenderHelper.instance;

    renderHelper.setRenderBounds(0, 0, 0.4375, 1, 1, 0.5625);
    renderHelper.renderFace(RenderHelper.ZNEG, null, Blocks.torch, Blocks.torch.getIcon(2, 0), meta);
    renderHelper.renderFace(RenderHelper.ZPOS, null, Blocks.torch, Blocks.torch.getIcon(3, 0), meta);
    renderHelper.setRenderBounds(0.4375, 0, 0, 0.5625, 1, 1);
    renderHelper.renderFace(RenderHelper.XNEG, null, Blocks.torch, Blocks.torch.getIcon(4, 0), meta);
    renderHelper.renderFace(RenderHelper.XPOS, null, Blocks.torch, Blocks.torch.getIcon(5, 0), meta);
    renderHelper.setRenderBounds(0.4375, 0, 0.4375, 0.5625, 0.625, 0.5625);
    renderHelper.renderFace(RenderHelper.YPOS, null, Blocks.torch, Blocks.torch.getIcon(1, 0), meta);
}
 
Example 7
Source File: CandleLanternSource.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta) {
    float unit = 0.0625f;
    BlockCandelabra block = ModBlocks.candelabra;

    RenderHelper.instance.state.setRenderOffset(0, -.375f, 0);
    RenderHelper.instance.state.setColorMult(1, .9f, .8f, .5f);

    boxrender.setUnit(0);
    boxrender.setColor(ModularBoxRenderer.COLOR_WHITE);
    boxrender.setIcon(block.getIconCandleTop(), 1);
    for (int i = 2; i < 6; i++)
        boxrender.setIcon(block.getIconCandleSide(), i);

    int x = 0;
    int y = 0;
    int z = 0;

    // Candle
    boxrender.renderExterior(null, block, x, y, z, unit * 6.5f, unit * 7, unit * 6.5f, unit * 9.5f, unit * 13, unit * 9.5f, 0, ModularBoxRenderer.CUT_YNEG);

    RenderHelper.instance.state.resetColorMult();

    RenderHelper.instance.setRenderBounds(0, 0, 0, 1, 1, 1);
    RenderHelper.instance.renderCrossedSquares(block, meta, block.getIconCandleSide());

    RenderHelper.instance.state.clearRenderOffset();
}
 
Example 8
Source File: VanillaLanternSource.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta) {
    RenderHelper renderHelper = RenderHelper.instance;

    renderHelper.setRenderBounds(0, 0, 0.4375, 1, 1, 0.5625);
    renderHelper.renderFace(RenderHelper.ZNEG, null, Blocks.redstone_torch, Blocks.redstone_torch.getIcon(2, 0), meta);
    renderHelper.renderFace(RenderHelper.ZPOS, null, Blocks.redstone_torch, Blocks.redstone_torch.getIcon(3, 0), meta);
    renderHelper.setRenderBounds(0.4375, 0, 0, 0.5625, 1, 1);
    renderHelper.renderFace(RenderHelper.XNEG, null, Blocks.redstone_torch, Blocks.redstone_torch.getIcon(4, 0), meta);
    renderHelper.renderFace(RenderHelper.XPOS, null, Blocks.redstone_torch, Blocks.redstone_torch.getIcon(5, 0), meta);
    renderHelper.setRenderBounds(0.4375, 0, 0.4375, 0.5625, 0.625, 0.5625);
    renderHelper.renderFace(RenderHelper.YPOS, null, Blocks.redstone_torch, Blocks.redstone_torch.getIcon(1, 0), meta);
}
 
Example 9
Source File: BW_GT_ItemRenderer.java    From bartworks with MIT License 5 votes vote down vote up
@Override
public boolean handleRenderType(ItemStack aStack, IItemRenderer.ItemRenderType aType) {
    if (!GT_Utility.isStackInvalid(aStack) && aStack.getItemDamage() >= 0) {
        return aType == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON || aType == IItemRenderer.ItemRenderType.INVENTORY || aType == IItemRenderer.ItemRenderType.EQUIPPED || aType == IItemRenderer.ItemRenderType.ENTITY;
    } else {
        return false;
    }
}
 
Example 10
Source File: ItemJarExtendedNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
    if (helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK) {
        return false;
    }
    return true;
}
 
Example 11
Source File: ItemJarExtendedNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
    if (item.getItem() == RegisteredItems.itemExtendedNodeJar) {
        if (type == IItemRenderer.ItemRenderType.ENTITY) {
            GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
        } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
            GL11.glTranslatef(0.0F, 0.0F, -0.5F);
        }
        TileJarNode tjf = new TileJarNode();
        if (item.hasTagCompound()) {
            AspectList aspects = ((ItemExtendedNodeJar) item.getItem()).getAspects(item);
            if (aspects != null) {
                tjf.setAspects(aspects);
                tjf.setNodeType(((ItemExtendedNodeJar) item.getItem()).getNodeType(item));
                tjf.setNodeModifier(((ItemExtendedNodeJar) item.getItem()).getNodeModifier(item));
            }
        }
        tjf.blockType = ConfigBlocks.blockJar;
        tjf.blockMetadata = 2;
        GL11.glPushMatrix();
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileJar(), 0.0D, 0.0D, 0.0D, 0.0F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glTranslated(0.5D, 0.4D, 0.5D);
        ItemNodeRenderer.renderItemNode(tjf);
        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        ItemNodeRenderer.renderItemNode(tjf);
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        ItemNodeRenderer.renderItemNode(tjf);
        GL11.glPopMatrix();


        GL11.glPushMatrix();
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        this.rb.useInventoryTint = true;
        this.rb.renderBlockAsItem(RegisteredBlocks.blockExtendedNodeJar, item.getItemDamage(), 1.0F);
        GL11.glPopMatrix();


        GL11.glEnable(32826);
    }
}
 
Example 12
Source File: ItemNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
    return (item != null) && (item.getItem() == Item.getItemFromBlock(ConfigBlocks.blockAiry)) && ((item.getItemDamage() == 0) || (item.getItemDamage() == 5));
}
 
Example 13
Source File: ItemNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
    if (helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK) {
        return false;
    }
    return true;
}
 
Example 14
Source File: ItemWrapperMethods.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
default boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
	return true;
}
 
Example 15
Source File: ItemNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
    renderNodeItem(type, item, aspects, NodeType.NORMAL, null, data);
}
 
Example 16
Source File: ItemWrapperMethods.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
default boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
	return item.getItem() == this && getIcon(item, 0) == null;
}
 
Example 17
Source File: VanillaLanternSource.java    From GardenCollection with MIT License 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta) {
    RenderHelper.instance.setRenderBounds(.3, 0, .3, .7, .4, .7);
    RenderHelper.instance.renderBlock(null, Blocks.glowstone, 0);
}
 
Example 18
Source File: StandardLanternSource.java    From GardenCollection with MIT License 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta) { }
 
Example 19
Source File: ILanternSource.java    From GardenCollection with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
void renderItem (RenderBlocks renderer, IItemRenderer.ItemRenderType renderType, int meta);
 
Example 20
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);
        }
    }