User Tools

Site Tools


tutorial:tooltip

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorial:tooltip [2019/07/24 12:48] (current)
fudge created
Line 1: Line 1:
 +====== Adding a tooltip ====== 
 +In your [[tutorial:​items|item]] class, override ''​appendTooltip''​ like so (see [[tutorial:​lang]] for how to translate the tooltip) : 
 +<code java> 
 +@Override 
 +public void appendTooltip(ItemStack itemStack, World world, List<​Text>​ tooltip, TooltipContext tooltipContext) { 
 +    tooltip.add(new TranslatableText("​item.tutorial.fabric_item.tooltip"​));​ 
 +
 +</​code>​ 
 +For a block, do the same but override ''​buildTooltip''​ in your [[tutorial:​blocks|block]] class.
tutorial/tooltip.txt · Last modified: 2019/07/24 12:48 by fudge