Skip to main content
Version: 26.2

Client Tooltip Events

dev.architectury.event.events.client.ClientTooltipEvent

Add lines to item tooltips, or hook into how tooltips are rendered and positioned.

Events

EventListener methodReturns
ITEMappend(ItemStack, List<Component> lines, Item.TooltipContext, TooltipFlag)void - add to the tooltip text.
RENDER_PRErenderTooltip(GuiGraphicsExtractor, List<ClientTooltipComponent> texts, int x, int y)EventResult - interrupt to cancel vanilla tooltip rendering.
RENDER_MODIFY_POSITIONrenderTooltip(GuiGraphicsExtractor, PositionContext)void - move the tooltip.

The lines list in ITEM is mutable - add Components to it to append tooltip text. The PositionContext in RENDER_MODIFY_POSITION exposes getTooltipX/Y() and setTooltipX/Y(int).

Example

Add a line to every diamond's tooltip:

ClientTooltipEvent.ITEM.register((stack, lines, context, flag) -> {
if (stack.is(Items.DIAMOND)) {
lines.add(Component.literal("Shiny!").withStyle(ChatFormatting.AQUA));
}
});