Interface IClientItemExtensions
Item
.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
applyForgeHandTransform
(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, 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
(ItemStack stack, LivingEntity entity, ArmorMaterial.Layer layer, int layerIdx, int fallbackColor) Called when armor layers are rendered byHumanoidArmorLayer
.default HumanoidModel.ArmPose
getArmPose
(LivingEntity entityLiving, InteractionHand hand, 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 BlockEntityWithoutLevelRenderer
Queries this item's renderer.default int
getDefaultDyeColor
(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, LivingEntity, ArmorMaterial.Layer, int, int)
as thefallbackColor
parameter.default @Nullable Font
getFont
(ItemStack stack, IClientItemExtensions.FontContext context) Returns the font used to render data related to this item as specified in thecontext
.default Model
getGenericArmorModel
(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the armor model for this item when it's equipped.default HumanoidModel
<?> getHumanoidArmorModel
(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the humanoid armor model for this item when it's equipped.static IClientItemExtensions
static IClientItemExtensions
default void
renderHelmetOverlay
(ItemStack stack, Player player, int width, int height, float partialTick) Deprecated, for removal: This API element is subject to removal in a future version.default void
renderHelmetOverlay
(ItemStack stack, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) Called when the client starts rendering the HUD, and is wearing this item in the helmet slot.default void
setupModelAnimations
(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, 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
(ItemStack stack) Returns Whether the item should bob when rendered in the world as an entity.default boolean
shouldSpreadAsEntity
(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 Font getFont(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 HumanoidModel.ArmPose getArmPose(LivingEntity entityLiving, InteractionHand hand, 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(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, 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 HumanoidModel<?> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the humanoid armor model for this item when it's equipped.- Parameters:
livingEntity
- The entity wearing the armoritemStack
- The item stackequipmentSlot
- 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 Model getGenericArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the armor model for this item when it's equipped. Useful in place ofgetHumanoidArmorModel(LivingEntity, ItemStack, EquipmentSlot, HumanoidModel)
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:
livingEntity
- The entity wearing the armoritemStack
- The item stackequipmentSlot
- 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(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, 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
-
renderHelmetOverlay
@Deprecated(forRemoval=true) default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTick) Deprecated, for removal: This API element is subject to removal in a future version. -
renderHelmetOverlay
default void renderHelmetOverlay(ItemStack stack, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) Called when the client starts rendering the HUD, and is wearing this item in the helmet slot.This is where pumpkins would render their overlay.
- Parameters:
stack
- The item stackplayer
- The player entityguiGraphics
- The gui graphicsdeltaTracker
- The delta tracker
-
getCustomRenderer
Queries this item's renderer.Only used if
BakedModel.isCustomRenderer()
returnstrue
orBlockBehaviour.BlockStateBase.getRenderShape()
returnsRenderShape.ENTITYBLOCK_ANIMATED
.By default, returns vanilla's block entity renderer.
-
shouldBobAsEntity
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
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(ItemStack stack, LivingEntity entity, ArmorMaterial.Layer layer, int layerIdx, int fallbackColor) Called when armor layers are rendered byHumanoidArmorLayer
.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 renderedentity
- the entity wearing the armorlayer
- 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
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, LivingEntity, ArmorMaterial.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
-
renderHelmetOverlay(ItemStack, Player, GuiGraphics, DeltaTracker)