MinecraftForge icon indicating copy to clipboard operation
MinecraftForge copied to clipboard

EntityLivingBase ignores NBT when rendering held items with multiple render passes

Open SimonMeskens opened this issue 12 years ago • 2 comments

In EntityLivingBase:

@SideOnly(Side.CLIENT)
public IIcon getItemIcon(ItemStack p_70620_1_, int p_70620_2_)
{
    return p_70620_1_.getItem().requiresMultipleRenderPasses() ? 
        p_70620_1_.getItem().getIconFromDamageForRenderPass(p_70620_1_.getItemDamage(), p_70620_2_) : 
        p_70620_1_.getIconIndex();
}

When there's multiple render passes:

  • Get the Item
  • Try rendering from Item damage and render pass

When there's just one render pass:

  • Get the icon index from the ItemStack

In the case of multiple render passes, this means that the stack and thus all NBT is dropped in favor of trying to render from Item Damage. This means that all mods that have items that do NBT-dependent multi-pass rendering (for example, Tinkers Construct), have to write a completely useless item renderer, just so they get access to NBT.

The very simple fix:

@SideOnly(Side.CLIENT)
public IIcon getItemIcon(ItemStack p_70620_1_, int p_70620_2_)
{
    return p_70620_1_.getItem().requiresMultipleRenderPasses() ? 
        p_70620_1_.getItem().getIcon(p_70620_1_, p_70620_2_) : 
        p_70620_1_.getIconIndex();
}

SimonMeskens avatar Oct 04 '14 19:10 SimonMeskens

getColorFromItemStack in 1.8+ is fully stack aware Item.getModel (1.8.x) and IPropertyGetters (1.9) are both stack and entity aware

williewillus avatar Mar 30 '16 15:03 williewillus

@williewillus closed this issue

Actuarius avatar Mar 30 '16 15:03 Actuarius