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(Factory, ItemLike...)
or register(ArmorRenderer, ItemLike...).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA factory to create anArmorRendererinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidregister(ArmorRenderer.Factory factory, net.minecraft.world.level.ItemLike... items) Registers the armor renderer for the specified items.static voidregister(ArmorRenderer renderer, net.minecraft.world.level.ItemLike... items) Registers the armor renderer for the specified items.voidrender(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 booleanshouldRenderDefaultHeadItem(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 aTransformCopyingModel, 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 aTransformCopyingModel, which will copy transforms from a source model to a delegate model when it is rendered.
-
Method Details
-
register
Registers the armor renderer for the specified items.- Parameters:
factory- the renderer factoryitems- the items- Throws:
IllegalArgumentException- if an item already has a registered armor rendererNullPointerException- if either an item or the factory is null
-
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
-
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 aTransformCopyingModel, which will copy transforms from a source model to a delegate model when it is rendered.- Type Parameters:
S- state type of the source modelD- state type of the delegate model- Parameters:
sourceModel- the model whose transforms will be copiedsourceModelState- the model state of the source modeldelegateModel- the model that will be rendered with transforms copied from the source modeldelegateModelState- the model state of the delegate modelsetDelegateAngles-trueif theModel.setupAnim(Object)method should be called for the delegate model after it is called for the source modelnodeCollector- theOrderedSubmitNodeCollectorposeStack- the pose stackrenderType- the render typelight- packed lightmap coordinatesoverlay- packed overlay texture coordinatestintedColor- the color to tint the model withsprite- the sprite to render the model with, ornullto use the render layer insteadoutlineColor- the outline color of the modelcrumblingOverlay- the crumbling overlay, ornullfor 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 aTransformCopyingModel, which will copy transforms from its source model to its delegate model when it is rendered.- Type Parameters:
S- state type of the source modelD- state type of the delegate model- Parameters:
sourceModel- the model whose transforms will be copiedsourceModelState- the model state of the source modeldelegateModel- the model that will be rendered with transforms copied from the source modeldelegateModelState- the model state of the delegate modelsetDelegateAngles-trueif theModel.setupAnim(Object)method should be called for the delegate model after it is called for the source modelnodeCollector- theOrderedSubmitNodeCollectorposeStack- the pose stackrenderType- the render typelight- packed lightmap coordinatesoverlay- packed overlay texture coordinatesoutlineColor- the outline color of the modelcrumblingOverlay- the crumbling overlay, ornullfor 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 stacksubmitNodeCollector- theSubmitNodeCollectorinstancestack- the item stack of the armor itemhumanoidRenderState- the render state of the entityslot- the equipment slot in which the armor stack is wornlight- packed lightmap coordinatescontextModel- the model provided byRenderLayer.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:equippablecomponent. This method cannot be used to overwrite that check to re-enable also rendering the item model. SeeHumanoidArmorLayer.shouldRender(ItemStack, EquipmentSlot).- Parameters:
entity- the equipping entitystack- the item stack equipped on the head- Returns:
trueif the head item should be rendered,falseotherwise
-