    001/**
    002 * This software is provided under the terms of the Minecraft Forge Public
    003 * License v1.0.
    004 */
    005
    006package net.minecraftforge.client;
    007
    008import org.lwjgl.opengl.Display;
    009
    010import net.minecraft.block.Block;
    011import net.minecraft.entity.Entity;
    012import net.minecraft.item.Item;
    013import net.minecraft.item.ItemStack;
    014import net.minecraft.client.renderer.RenderBlocks;
    015import net.minecraft.world.World;
    016import net.minecraftforge.client.IItemRenderer.ItemRenderType;
    017import net.minecraftforge.common.MinecraftForge;
    018
    019public class MinecraftForgeClient
    020{
    021    /**
    022     * NO-OP now. Not needed with new texturing system in MC 1.5
    023     */
    024    @Deprecated // without replacement
    025    public static void preloadTexture(String texture)
    026    {
    027//        ForgeHooksClient.engine().getTexture(texture);
    028    }
    029
    030    private static IItemRenderer[] customItemRenderers = new IItemRenderer[Item.itemsList.length];
    031
    032    /**
    033     * Register a custom renderer for a specific item. This can be used to
    034     * render the item in-world as an EntityItem, when the item is equipped, or
    035     * when the item is in an inventory slot.
    036     * @param itemID The item ID (shifted index) to handle rendering.
    037     * @param renderer The IItemRenderer interface that handles rendering for
    038     * this item.
    039     */
    040    public static void registerItemRenderer(int itemID, IItemRenderer renderer)
    041    {
    042        customItemRenderers[itemID] = renderer;
    043    }
    044
    045    public static IItemRenderer getItemRenderer(ItemStack item, ItemRenderType type)
    046    {
    047        IItemRenderer renderer = customItemRenderers[item.itemID];
    048        if (renderer != null && renderer.handleRenderType(item, type))
    049        {
    050            return customItemRenderers[item.itemID];
    051        }
    052        return null;
    053    }
    054
    055    public static int getRenderPass()
    056    {
    057        return ForgeHooksClient.renderPass;
    058    }
    059}