Interface TooltipComponentCallback


@Environment(CLIENT) public interface TooltipComponentCallback
Allows registering a mapping from TooltipData to TooltipComponent. This allows custom tooltips for items: first, override Item.getTooltipData(net.minecraft.item.ItemStack) and return a custom TooltipData. Second, register a listener to this event and convert the data to your component implementation if it's an instance of your data class.

Note that failure to map some data to a component will throw an exception, so make sure that any data you return in Item.getTooltipData(net.minecraft.item.ItemStack) will be handled by one of the callbacks.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.client.gui.tooltip.TooltipComponent
    getComponent(net.minecraft.client.item.TooltipData data)
    Return the tooltip component for the passed data, or null if none is available.
  • Field Details

  • Method Details

    • getComponent

      @Nullable @Nullable net.minecraft.client.gui.tooltip.TooltipComponent getComponent(net.minecraft.client.item.TooltipData data)
      Return the tooltip component for the passed data, or null if none is available.