Interface IClientItemExtensions


public interface IClientItemExtensions
Client-only extensions to Item.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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 by EquipmentLayerRenderer.
    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 the
    invalid reference
    net.minecraft.client.model.HumanoidModel.ArmPose#create(String, boolean, IArmPoseTransformer)
    method.
    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 to getArmorLayerTintColor(ItemStack, EquipmentClientInfo.Layer, int, int) as the fallbackColor 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 the context.
    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.
    of(net.minecraft.world.item.Item item)
     
    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

  • Method Details

    • of

      static IClientItemExtensions of(net.minecraft.world.item.ItemStack stack)
    • of

      static IClientItemExtensions of(net.minecraft.world.item.Item item)
    • 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 the context. Return null to use the default font.
      Parameters:
      stack - The item stack
      context - 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 the
      invalid reference
      net.minecraft.client.model.HumanoidModel.ArmPose#create(String, boolean, IArmPoseTransformer)
      method. This allows for creating custom item use animations.
      Parameters:
      entityLiving - The entity holding the item
      hand - The hand the ArmPose will be applied to
      itemStack - 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 stack
      player - The player holding the item, it's always main client player
      arm - The arm holding the item
      itemInHand - The held item
      partialTick - Partial tick time, useful for interpolation
      equipProcess - Equip process time, Ranging from 0.0 to 1.0. 0.0 when it's done equipping
      swingProcess - 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 stack
      layerType - The slot the item is in
      original - 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 of getHumanoidArmorModel(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 stack
      layerType - The slot the item is in
      original - 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 armor
      itemStack - The item stack being worn
      equipmentSlot - The slot the armor stack is being worn in
      model - The armor model being rendered
      limbSwing - The swing position of the entity's walk animation
      limbSwingAmount - The swing speed of the entity's walk animation
      partialTick - The partial tick time
      ageInTicks - The total age of the entity, with partialTick already applied
      netHeadYaw - The yaw (Y rotation) of the entity's head
      headPitch - 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 wearing
      equipmentSlot - The slot in which the player is wearing or holding the above item stack
      player - The player entity
      guiGraphics - The gui graphics
      deltaTracker - 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 by EquipmentLayerRenderer.

      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 rendered
      layer - the armor layer being rendered
      layerIdx - an index into the list of layers for the ArmorMaterial used by this item
      fallbackColor - the return value of getDefaultDyeColor(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 to getArmorLayerTintColor(ItemStack, EquipmentClientInfo.Layer, int, int) as the fallbackColor 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 the DataComponents.EQUIPPABLE component. Returning null from this function will use the default value.
      Parameters:
      stack - ItemStack for the equipped armor
      type - The layer type of the armor
      layer - The armor layer
      _default - The default texture determined by the equipment renderer
      Returns:
      Path of texture to bind, or null to use default