Interface ArmorRenderer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Armor renderers render worn armor items with custom code.
They may be used to render armor with special models or effects.
The renderers are registered with register(ArmorRenderer, ItemConvertible...).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidregister(ArmorRenderer renderer, ItemConvertible... items) Registers the armor renderer for the specified items.voidrender(MatrixStack matrices, OrderedRenderCommandQueue orderedRenderCommandQueue, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel<BipedEntityRenderState> contextModel) Renders an armor part.default booleanshouldRenderDefaultHeadItem(LivingEntity entity, ItemStack stack) Checks whether an item stack equipped on the head should also be rendered as an item.
-
Method Details
-
register
Registers the armor renderer for the specified items.- Parameters:
renderer- the rendereritems- the items- Throws:
IllegalArgumentException- if an item already has a registered armor rendererNullPointerException- if either an item or the renderer is null
-
render
void render(MatrixStack matrices, OrderedRenderCommandQueue orderedRenderCommandQueue, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel<BipedEntityRenderState> contextModel) Renders an armor part.- Parameters:
matrices- the matrix stackorderedRenderCommandQueue- theOrderedRenderCommandQueueinstancestack- the item stack of the armor itembipedEntityRenderState- the render state of the entityslot- the equipment slot in which the armor stack is wornlight- packed lightmap coordinatescontextModel- the model provided byFeatureRenderer.getContextModel()
-
shouldRenderDefaultHeadItem
Checks whether an item stack equipped on the head should also be rendered as an item. By default, vanilla renders most items with their models (or special item renderers) around or on top of the entity's head, but this is often unwanted for custom equipment.This method only applies to items registered with this renderer.
Note that the item will never be rendered by vanilla code if it has an armor model defined by the
minecraft:equippablecomponent. This method cannot be used to overwrite that check to re-enable also rendering the item model. SeeArmorFeatureRenderer.hasModel(ItemStack, EquipmentSlot).- Parameters:
entity- the equipping entitystack- the item stack equipped on the head- Returns:
trueif the head item should be rendered,falseotherwise
-