1,516 bytes added
, 03:58, 27 July 2021
<code>ItemStackTileEntityRenderer</code> is a class that allows custom usages of <code>MatrixStack</code>s and <code>IRenderTypeBuffer</code>s to render items.
== Using <tt>ItemStackTileEntityRenderer</tt> ==
<code>ItemStackTileEntityRenderer</code> allows you to render your item by extending the class and overriding <code><nowiki>ItemStackTileEntityRenderer#func_239207_a_</nowiki></code>.
In order to use a ISTER, the Item must first return true for <code><nowiki>IBakedModel#isBuiltInRenderer</nowiki></code>. It is also recommended that if you are using a block that <code>AbstractBlock#getRenderType</code> returns <code>BlockRenderType#ENTITYBLOCK_ANIMATED</code> so that it will render correctly in layers and minecarts. Once that returns true, the Item’s ISTER will be accessed for rendering. If it does not have one, it will use the default <code>ItemStackTileEntityRenderer#instance</code>.
To set the ISTER for an Item, use <code><nowiki>Item.Properties#setISTER</nowiki></code>. Each Item can only ever provide one ISTER, and the getter is final so that mods do not return new instances each frame.
That’s it, no additional setup is necessary to use a ISTER.
If you need to access the <code>TransformType</code> for rendering, you can store the one passed through <code><nowiki>IBakedModel#handlePerspective</nowiki></code> and use it during rendering. This method will always be called before <code><nowiki>ItemStackTileEntityRenderer#func_239207_a_</nowiki></code>.
[[Category:Items/1.16]]