Interface TooltipComponentCallback


public interface TooltipComponentCallback
Allows registering a mapping from TooltipComponent to ClientTooltipComponent. This allows custom tooltips for items: first, override Item.getTooltipImage(net.minecraft.world.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.getTooltipImage(net.minecraft.world.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.screens.inventory.tooltip.ClientTooltipComponent
    getComponent(net.minecraft.world.inventory.tooltip.TooltipComponent data)
    Return the tooltip component for the passed data, or null if none is available.
  • Field Details

  • Method Details

    • getComponent

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