Interface IClientItemExtensions
Item
.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
applyForgeHandTransform
(com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.player.LocalPlayer player, net.minecraft.world.entity.HumanoidArm arm, net.minecraft.world.item.ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) Called right before when client applies transformations to item in hand and render it.default int
getArmorLayerTintColor
(net.minecraft.world.item.ItemStack stack, net.minecraft.client.resources.model.EquipmentClientInfo.Layer layer, int layerIdx, int fallbackColor) Called when armor layers are rendered byEquipmentLayerRenderer
.default @Nullable net.minecraft.resources.ResourceLocation
getArmorTexture
(net.minecraft.world.item.ItemStack stack, net.minecraft.client.resources.model.EquipmentClientInfo.LayerType type, net.minecraft.client.resources.model.EquipmentClientInfo.Layer layer, net.minecraft.resources.ResourceLocation _default) Called by RenderBiped and RenderPlayer to determine the armor texture that should be used for the currently equipped item.default net.minecraft.client.model.HumanoidModel.ArmPose
getArmPose
(net.minecraft.world.entity.LivingEntity entityLiving, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack itemStack) This method returns an ArmPose that can be defined using theinvalid reference
net.minecraft.client.model.HumanoidModel.ArmPose#create(String, boolean, IArmPoseTransformer)
default int
getDefaultDyeColor
(net.minecraft.world.item.ItemStack stack) Called once per render pass of equipped armor items, regardless of the number of layers; the return value of this method is passed togetArmorLayerTintColor(ItemStack, EquipmentClientInfo.Layer, int, int)
as thefallbackColor
parameter.default @Nullable net.minecraft.client.gui.Font
getFont
(net.minecraft.world.item.ItemStack stack, IClientItemExtensions.FontContext context) Returns the font used to render data related to this item as specified in thecontext
.default net.minecraft.client.model.Model
getGenericArmorModel
(net.minecraft.world.item.ItemStack itemStack, net.minecraft.client.resources.model.EquipmentClientInfo.LayerType layerType, net.minecraft.client.model.Model original) Queries the armor model for this item when it's equipped.default net.minecraft.client.model.Model
getHumanoidArmorModel
(net.minecraft.world.item.ItemStack itemStack, net.minecraft.client.resources.model.EquipmentClientInfo.LayerType layerType, net.minecraft.client.model.Model original) Queries the humanoid armor model for this item when it's equipped.static IClientItemExtensions
of
(net.minecraft.world.item.Item item) static IClientItemExtensions
of
(net.minecraft.world.item.ItemStack stack) default void
renderFirstPersonOverlay
(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.EquipmentSlot equipmentSlot, net.minecraft.world.entity.player.Player player, net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.client.DeltaTracker deltaTracker) Called to render an overlay on the first-person camera.default void
setupModelAnimations
(net.minecraft.world.entity.LivingEntity livingEntity, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.entity.EquipmentSlot equipmentSlot, net.minecraft.client.model.Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) Called when an armor piece is about to be rendered, allowing parts of the model to be animated or changed.default boolean
shouldBobAsEntity
(net.minecraft.world.item.ItemStack stack) Returns Whether the item should bob when rendered in the world as an entity.default boolean
shouldSpreadAsEntity
(net.minecraft.world.item.ItemStack stack) Returns Whether the item should be spread out when rendered in the world as an entity.
-
Field Details
-
DEFAULT
-
-
Method Details
-
of
-
of
-
getFont
@Nullable default @Nullable net.minecraft.client.gui.Font getFont(net.minecraft.world.item.ItemStack stack, IClientItemExtensions.FontContext context) Returns the font used to render data related to this item as specified in thecontext
. Returnnull
to use the default font.- Parameters:
stack
- The item stackcontext
- The context in which the font will be used- Returns:
- A
Font
or null to use the default
-
getArmPose
@Nullable default net.minecraft.client.model.HumanoidModel.ArmPose getArmPose(net.minecraft.world.entity.LivingEntity entityLiving, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack itemStack) This method returns an ArmPose that can be defined using theinvalid reference
net.minecraft.client.model.HumanoidModel.ArmPose#create(String, boolean, IArmPoseTransformer)
- Parameters:
entityLiving
- The entity holding the itemhand
- The hand the ArmPose will be applied toitemStack
- The stack being held- Returns:
- A custom ArmPose that can be used to define movement of the arm
-
applyForgeHandTransform
default boolean applyForgeHandTransform(com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.player.LocalPlayer player, net.minecraft.world.entity.HumanoidArm arm, net.minecraft.world.item.ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) Called right before when client applies transformations to item in hand and render it.- Parameters:
poseStack
- The pose stackplayer
- The player holding the item, it's always main client playerarm
- The arm holding the itemitemInHand
- The held itempartialTick
- Partial tick time, useful for interpolationequipProcess
- Equip process time, Ranging from 0.0 to 1.0. 0.0 when it's done equippingswingProcess
- Swing process time, Ranging from 0.0 to 1.0. 0.0 when it's done swinging- Returns:
- true if it should skip applying other transforms and go straight to rendering
-
getHumanoidArmorModel
default net.minecraft.client.model.Model getHumanoidArmorModel(net.minecraft.world.item.ItemStack itemStack, net.minecraft.client.resources.model.EquipmentClientInfo.LayerType layerType, net.minecraft.client.model.Model original) Queries the humanoid armor model for this item when it's equipped.- Parameters:
itemStack
- The item stacklayerType
- The slot the item is inoriginal
- The original armor model. Will have attributes set.- Returns:
- A HumanoidModel to be rendered. Relevant properties are to be copied over by the caller.
- See Also:
-
getGenericArmorModel
default net.minecraft.client.model.Model getGenericArmorModel(net.minecraft.world.item.ItemStack itemStack, net.minecraft.client.resources.model.EquipmentClientInfo.LayerType layerType, net.minecraft.client.model.Model original) Queries the armor model for this item when it's equipped. Useful in place ofgetHumanoidArmorModel(ItemStack, EquipmentClientInfo.LayerType, Model)
for wrapping the original model or returning anything non-standard.If you override this method you are responsible for copying any properties you care about from the original model.
- Parameters:
itemStack
- The item stacklayerType
- The slot the item is inoriginal
- The original armor model. Will have attributes set.- Returns:
- A Model to be rendered. Relevant properties must be copied over manually.
- See Also:
-
setupModelAnimations
default void setupModelAnimations(net.minecraft.world.entity.LivingEntity livingEntity, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.entity.EquipmentSlot equipmentSlot, net.minecraft.client.model.Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) Called when an armor piece is about to be rendered, allowing parts of the model to be animated or changed.- Parameters:
livingEntity
- The entity wearing the armoritemStack
- The item stack being wornequipmentSlot
- The slot the armor stack is being worn inmodel
- The armor model being renderedlimbSwing
- The swing position of the entity's walk animationlimbSwingAmount
- The swing speed of the entity's walk animationpartialTick
- The partial tick timeageInTicks
- The total age of the entity, with partialTick already appliednetHeadYaw
- The yaw (Y rotation) of the entity's headheadPitch
- The pitch (X rotation) of the entity's head
-
renderFirstPersonOverlay
default void renderFirstPersonOverlay(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.EquipmentSlot equipmentSlot, net.minecraft.world.entity.player.Player player, net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.client.DeltaTracker deltaTracker) Called to render an overlay on the first-person camera.This method will always be called to render an overlay, regardless of whether the client camera overlay provided by the
Equippable data component
is present. If the equippable overlay is present (e.g. the pumpkin overlay), this method will be called after it has been rendered.This method should be used if the overlay is dynamic or has dynamic components. For a static overlay, prefer using
Equippable.cameraOverlay()
.- Parameters:
stack
- The item stack that the player is wearingequipmentSlot
- The slot in which the player is wearing or holding the above item stackplayer
- The player entityguiGraphics
- The gui graphicsdeltaTracker
- The delta tracker
-
shouldBobAsEntity
default boolean shouldBobAsEntity(net.minecraft.world.item.ItemStack stack) Returns Whether the item should bob when rendered in the world as an entity.- Parameters:
stack
- The stack being rendered- Returns:
- Whether the item should bob when rendered in the world as an entity
-
shouldSpreadAsEntity
default boolean shouldSpreadAsEntity(net.minecraft.world.item.ItemStack stack) Returns Whether the item should be spread out when rendered in the world as an entity.- Parameters:
stack
- The stack being rendered- Returns:
- Whether the item should be spread out when rendered in the world as an entity
-
getArmorLayerTintColor
default int getArmorLayerTintColor(net.minecraft.world.item.ItemStack stack, net.minecraft.client.resources.model.EquipmentClientInfo.Layer layer, int layerIdx, int fallbackColor) Called when armor layers are rendered byEquipmentLayerRenderer
.Allows custom dye colors to be specified per-layer; default vanilla behavior allows for only a single dye color (specified by the
DataComponents.DYED_COLOR
data component) for all layers.Returning 0 here will cause rendering of this layer to be skipped entirely; this is recommended if the layer doesn't need to be rendered for a particular armor slot.
- Parameters:
stack
- the armor item stack being renderedlayer
- the armor layer being renderedlayerIdx
- an index into the list of layers for theArmorMaterial
used by this itemfallbackColor
- the return value ofgetDefaultDyeColor(ItemStack)
, passed as a parameter for performance- Returns:
- a custom color for the layer, in ARGB format, or 0 to skip rendering
-
getDefaultDyeColor
default int getDefaultDyeColor(net.minecraft.world.item.ItemStack stack) Called once per render pass of equipped armor items, regardless of the number of layers; the return value of this method is passed togetArmorLayerTintColor(ItemStack, EquipmentClientInfo.Layer, int, int)
as thefallbackColor
parameter.You can override this method for your custom armor item to provide an alternative default color for the item when no explicit color is specified.
- Parameters:
stack
- the armor item stack- Returns:
- a default color for the layer, in ARGB format
-
getArmorTexture
@Nullable default @Nullable net.minecraft.resources.ResourceLocation getArmorTexture(net.minecraft.world.item.ItemStack stack, net.minecraft.client.resources.model.EquipmentClientInfo.LayerType type, net.minecraft.client.resources.model.EquipmentClientInfo.Layer layer, net.minecraft.resources.ResourceLocation _default) Called by RenderBiped and RenderPlayer to determine the armor texture that should be used for the currently equipped item. This will be called on stacks with theDataComponents.EQUIPPABLE
component. Returning null from this function will use the default value.- Parameters:
stack
- ItemStack for the equipped armortype
- The layer type of the armorlayer
- The armor layer_default
- The default texture determined by the equipment renderer- Returns:
- Path of texture to bind, or null to use default
-