Custom Item rendering using lltemRenderer - Himmelt/MinecraftModing GitHub Wiki

Custom Item rendering using lltemRenderer

If you want your item to have non-vanilla rendering, your best best is probably to make use of the Forge 11temRenderer interface. The same method in this interface is regardless of whether the view is Inventory, Equipped (First person or Third person), or Dropped ("ENTITY"). The diagram below shows the various entry points. The key co

  1. Write your rendering class to implement lltemRenderer. Register it with MinecraftForgeClient.registerltemRenderer().
  2. The same method (lltemRenderer.renderltem) is called for all views, with one of the five ItemRenderTypes (INVENTORY, ENTITY, etc) passed in as a parameter.
  3. Your render code in renderltem() should look at the rendertype parameter to decide which view it needs to render.
  4. Your code should override .handleRenderType to return true for each of the rendering views it supports.
  5. ForgeHooksClient can apply a number of different transformations to the view before passing control to your .renderltem code. These are called RenderHelpers. Be MinecraftForgeClient queries lltemRenderer.shouldUseRenderHelper(HELPER) to see whether it should apply that helper or not. For further details see below.

[PIC] Diagram showing how the vanilla code interfaces with lltemRenderer to render the various different views of an Item.

RenderHelpers The diagrams below show how the four different render types (INVENTORY, EQUIPPED, and ENTITY) are affected by the various RenderHelpers. U caller expects you to render over is not consistent for the different views. In most cases a transformation using GLII .glTranslatef() and GLI 1 .glScalef() will be the easiest all a bit confusing, looking at the sample code may help.