001    package net.minecraftforge.client;
002    
003    import net.minecraft.entity.item.EntityItem;
004    import net.minecraft.entity.EntityLiving;
005    import net.minecraft.item.ItemStack;
006    import net.minecraft.client.renderer.RenderBlocks;
007    
008    public interface IItemRenderer
009    {
010        public enum ItemRenderType
011        {
012            /** 
013             * Called to render an in-world item, e.g. one that has been thrown or
014             * dropped. The appropriate OpenGL transformations and scaling have already
015             * been applied, so Tessellator location (0,0,0) is the center of the
016             * EntityItem.
017             * 
018             * Data parameters:
019             * RenderBlocks render - The RenderBlocks instance
020             * EntityItem entity - The in-world item to be rendered
021             */
022            ENTITY, 
023            
024            /** 
025             * Called to render an item currently held in-hand by a living entity. If
026             * rendering as a 3D block, the item will be rotated to a 45-degree angle.
027             * To render a 2D texture with some thickness (like default items), see
028             * net.minecraft.src.ItemRenderer. In either case, rendering should be done
029             * in local coordinates from (0,0,0)-(1,1,1).
030             * 
031             * Data parameters:
032             * RenderBlocks render - The RenderBlocks instance
033             * EntityLiving entity - The entity holding this item
034             */
035            EQUIPPED, 
036            
037            /** 
038             * Called to render an item in a GUI inventory slot. If rendering as a 3D
039             * block, the appropriate OpenGL translations and scaling have already been
040             * applied, and the rendering should be done in local coordinates from
041             * (0,0,0)-(1,1,1). If rendering as a 2D texture, the rendering should be in
042             * GUI pixel coordinates from (0, 0, 0)-(16, 16, 0).
043             * 
044             * Data parameters:
045             * RenderBlocks render - The RenderBlocks instance
046             */
047            INVENTORY,
048            
049            /**
050             * The render type used for when a ItemMap is rendered in first person, 
051             * All appropriate rotations have been applied, and the player's hands, 
052             * and the map BG are already rendered.
053             * 
054             * Data Parameters:
055             * EntityPlayer player - The player holding the map
056             * RenderEngine engine - The RenderEngine instance
057             * MapData mapData - The map data
058             */
059            FIRST_PERSON_MAP
060        }
061        
062        public enum ItemRendererHelper
063        {
064            /** 
065             * Determines if a rotation effect should be used when rendering an
066             * EntityItem, like most default blocks do.
067             */
068            ENTITY_ROTATION,
069            
070            /** 
071             * Determines if an up-and-down bobbing effect should be used when
072             * rendering an EntityItem, like most default items do.
073             */
074            ENTITY_BOBBING,
075    
076            /** 
077             * Determines if the currently equipped item should be rendered as a 3D
078             * block or as a 2D texture.
079             */
080            EQUIPPED_BLOCK,
081            
082            /**
083             * Determines if the item should equate to a block that has 
084             * RenderBlocks.renderItemIn3d return true
085             */
086            BLOCK_3D,
087    
088            /** 
089             * Determines if the item should be rendered in GUI inventory slots as a 3D
090             * block or as a 2D texture.
091             */
092            INVENTORY_BLOCK
093        }
094        
095        /** 
096         * Checks if this renderer should handle a specific item's render type
097         * @param item The item we are trying to render
098         * @param type A render type to check if this renderer handles
099         * @return true if this renderer should handle the given render type,
100         * otherwise false
101         */
102        public boolean handleRenderType(ItemStack item, ItemRenderType type);
103        
104        /**
105         * Checks if certain helper functionality should be executed for this renderer.
106         * See ItemRendererHelper for more info
107         * 
108         * @param type The render type
109         * @param item The ItemStack being rendered
110         * @param helper The type of helper functionality to be ran
111         * @return True to run the helper functionality, false to not.
112         */
113        public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper);
114        
115        /**
116         * Called to do the actual rendering, see ItemRenderType for details on when specific 
117         * types are run, and what extra data is passed into the data parameter.
118         * 
119         * @param type The render type
120         * @param item The ItemStack being rendered
121         * @param data Extra Type specific data
122         */
123        public void renderItem(ItemRenderType type, ItemStack item, Object... data);
124    }