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.

@FunctionalInterface public interface ArmorRenderer
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 Details

    • register

      static void register(ArmorRenderer renderer, ItemConvertible... items)
      Registers the armor renderer for the specified items.
      Parameters:
      renderer - the renderer
      items - the items
      Throws:
      IllegalArgumentException - if an item already has a registered armor renderer
      NullPointerException - 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 stack
      orderedRenderCommandQueue - the OrderedRenderCommandQueue instance
      stack - the item stack of the armor item
      bipedEntityRenderState - the render state of the entity
      slot - the equipment slot in which the armor stack is worn
      light - packed lightmap coordinates
      contextModel - the model provided by FeatureRenderer.getContextModel()
    • shouldRenderDefaultHeadItem

      default boolean shouldRenderDefaultHeadItem(LivingEntity entity, ItemStack stack)
      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:equippable component. This method cannot be used to overwrite that check to re-enable also rendering the item model. See ArmorFeatureRenderer.hasModel(ItemStack, EquipmentSlot).

      Parameters:
      entity - the equipping entity
      stack - the item stack equipped on the head
      Returns:
      true if the head item should be rendered, false otherwise