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(Factory, ItemLike...) or register(ArmorRenderer, ItemLike...).

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A factory to create an ArmorRenderer instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    register(ArmorRenderer.Factory factory, net.minecraft.world.level.ItemLike... items)
    Registers the armor renderer for the specified items.
    static void
    register(ArmorRenderer renderer, net.minecraft.world.level.ItemLike... items)
    Registers the armor renderer for the specified items.
    void
    render(com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector submitNodeCollector, net.minecraft.world.item.ItemStack stack, net.minecraft.client.renderer.entity.state.HumanoidRenderState humanoidRenderState, net.minecraft.world.entity.EquipmentSlot slot, int light, net.minecraft.client.model.HumanoidModel<net.minecraft.client.renderer.entity.state.HumanoidRenderState> contextModel)
    Renders an armor part.
    default boolean
    shouldRenderDefaultHeadItem(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack stack)
    Checks whether an item stack equipped on the head should also be rendered as an item.
    static <S,D> void
    submitTransformCopyingModel(net.minecraft.client.model.Model<? super S> sourceModel, S sourceModelState, net.minecraft.client.model.Model<? super D> delegateModel, D delegateModelState, boolean setDelegateAngles, net.minecraft.client.renderer.OrderedSubmitNodeCollector nodeCollector, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.rendertype.RenderType renderType, int light, int overlay, int outlineColor, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay crumblingOverlay)
    Helper method for rendering a TransformCopyingModel, which will copy transforms from its source model to its delegate model when it is rendered.
    static <S,D> void
    submitTransformCopyingModel(net.minecraft.client.model.Model<? super S> sourceModel, S sourceModelState, net.minecraft.client.model.Model<? super D> delegateModel, D delegateModelState, boolean setDelegateAngles, net.minecraft.client.renderer.OrderedSubmitNodeCollector nodeCollector, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.rendertype.RenderType renderType, int light, int overlay, int tintedColor, @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite sprite, int outlineColor, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay crumblingOverlay)
    Helper method for rendering a TransformCopyingModel, which will copy transforms from a source model to a delegate model when it is rendered.
  • Method Details

    • register

      static void register(ArmorRenderer.Factory factory, net.minecraft.world.level.ItemLike... items)
      Registers the armor renderer for the specified items.
      Parameters:
      factory - the renderer factory
      items - the items
      Throws:
      IllegalArgumentException - if an item already has a registered armor renderer
      NullPointerException - if either an item or the factory is null
    • register

      static void register(ArmorRenderer renderer, net.minecraft.world.level.ItemLike... 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
    • submitTransformCopyingModel

      static <S,D> void submitTransformCopyingModel(net.minecraft.client.model.Model<? super S> sourceModel, S sourceModelState, net.minecraft.client.model.Model<? super D> delegateModel, D delegateModelState, boolean setDelegateAngles, net.minecraft.client.renderer.OrderedSubmitNodeCollector nodeCollector, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.rendertype.RenderType renderType, int light, int overlay, int tintedColor, @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite sprite, int outlineColor, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay crumblingOverlay)
      Helper method for rendering a TransformCopyingModel, which will copy transforms from a source model to a delegate model when it is rendered.
      Type Parameters:
      S - state type of the source model
      D - state type of the delegate model
      Parameters:
      sourceModel - the model whose transforms will be copied
      sourceModelState - the model state of the source model
      delegateModel - the model that will be rendered with transforms copied from the source model
      delegateModelState - the model state of the delegate model
      setDelegateAngles - true if the Model.setupAnim(Object) method should be called for the delegate model after it is called for the source model
      nodeCollector - the OrderedSubmitNodeCollector
      poseStack - the pose stack
      renderType - the render type
      light - packed lightmap coordinates
      overlay - packed overlay texture coordinates
      tintedColor - the color to tint the model with
      sprite - the sprite to render the model with, or null to use the render layer instead
      outlineColor - the outline color of the model
      crumblingOverlay - the crumbling overlay, or null for no crumbling overlay
    • submitTransformCopyingModel

      static <S,D> void submitTransformCopyingModel(net.minecraft.client.model.Model<? super S> sourceModel, S sourceModelState, net.minecraft.client.model.Model<? super D> delegateModel, D delegateModelState, boolean setDelegateAngles, net.minecraft.client.renderer.OrderedSubmitNodeCollector nodeCollector, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.rendertype.RenderType renderType, int light, int overlay, int outlineColor, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay crumblingOverlay)
      Helper method for rendering a TransformCopyingModel, which will copy transforms from its source model to its delegate model when it is rendered.
      Type Parameters:
      S - state type of the source model
      D - state type of the delegate model
      Parameters:
      sourceModel - the model whose transforms will be copied
      sourceModelState - the model state of the source model
      delegateModel - the model that will be rendered with transforms copied from the source model
      delegateModelState - the model state of the delegate model
      setDelegateAngles - true if the Model.setupAnim(Object) method should be called for the delegate model after it is called for the source model
      nodeCollector - the OrderedSubmitNodeCollector
      poseStack - the pose stack
      renderType - the render type
      light - packed lightmap coordinates
      overlay - packed overlay texture coordinates
      outlineColor - the outline color of the model
      crumblingOverlay - the crumbling overlay, or null for no crumbling overlay
    • render

      void render(com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector submitNodeCollector, net.minecraft.world.item.ItemStack stack, net.minecraft.client.renderer.entity.state.HumanoidRenderState humanoidRenderState, net.minecraft.world.entity.EquipmentSlot slot, int light, net.minecraft.client.model.HumanoidModel<net.minecraft.client.renderer.entity.state.HumanoidRenderState> contextModel)
      Renders an armor part.
      Parameters:
      poseStack - the pose stack
      submitNodeCollector - the SubmitNodeCollector instance
      stack - the item stack of the armor item
      humanoidRenderState - 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 RenderLayer.getParentModel()
    • shouldRenderDefaultHeadItem

      default boolean shouldRenderDefaultHeadItem(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.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 HumanoidArmorLayer.shouldRender(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