Interface ItemTooltipDataCallback


public interface ItemTooltipDataCallback
Event for adding more tooltip data to a stack's tooltip. Called when an item stack's tooltip is rendered.

Keep in mind that:

  • This event should be used for adding item independent data. If your data only affects one item, or one class, you should override Item.getTooltipImage(net.minecraft.world.item.ItemStack) instead of using this event.
  • If Item.getTooltipImage(net.minecraft.world.item.ItemStack) is not empty for the stack, it's added to the list before the event is fired.
  • Data added to list will be converted to a TooltipComponent via TooltipComponentCallback.EVENT before being rendered. If you don't register a TooltipComponent for your data, minecraft will throw an error.
  • These are rendered between item's name and the rest of the tooltip and all data added to list will be rendered in the order they were added, so the first added is rendered on top while the last added is at the bottom.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.fabricmc.fabric.api.event.Event<ItemTooltipDataCallback>
    Fired when ItemStack.getTooltipImage() is called.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    getTooltipData(net.minecraft.world.item.ItemStack stack, List<net.minecraft.world.inventory.tooltip.TooltipComponent> list)
    Called when an item stack's tooltip is rendered.
  • Field Details

    • EVENT

      static final net.fabricmc.fabric.api.event.Event<ItemTooltipDataCallback> EVENT
      Fired when ItemStack.getTooltipImage() is called.
  • Method Details

    • getTooltipData

      void getTooltipData(net.minecraft.world.item.ItemStack stack, List<net.minecraft.world.inventory.tooltip.TooltipComponent> list)
      Called when an item stack's tooltip is rendered. Any data added to list will be rendered with the tooltip.
      Parameters:
      stack - the stack requesting tooltip data.
      list - the list containing the data's to be displayed on the stack's tooltip.