Interface IClientItemExtensions


public interface IClientItemExtensions
Client-only extensions to Item.
See Also:
  • Field Details

  • Method Details

    • of

      static IClientItemExtensions of(ItemStack stack)
    • of

      static IClientItemExtensions of(Item item)
    • 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 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 HumanoidModel.ArmPose getArmPose(LivingEntity entityLiving, InteractionHand hand, ItemStack itemStack)
      This method returns an ArmPose that can be defined using the 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(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 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

      @NotNull default @NotNull 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 armor
      itemStack - The item stack
      equipmentSlot - 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

      @NotNull default @NotNull Model getGenericArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original)
      Queries the armor model for this item when it's equipped. Useful in place of getHumanoidArmorModel(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 armor
      itemStack - The item stack
      equipmentSlot - 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:
    • renderHelmetOverlay

      default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTick)
      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 stack
      player - The player entity
      width - The viewport width
      height - Viewport height
      partialTick - Partial tick time, useful for interpolation
    • getCustomRenderer

      default BlockEntityWithoutLevelRenderer getCustomRenderer()
      Queries this item's renderer.

      Only used if BakedModel.isCustomRenderer() returns true or BlockBehaviour.BlockStateBase.getRenderShape() returns RenderShape.ENTITYBLOCK_ANIMATED.

      By default, returns vanilla's block entity renderer.