User Tools

Site Tools


tutorial:tooltip
no way to compare when less than two revisions

Differences

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


Next revision
tutorial:tooltip [2019/07/24 12:48] – created fudge
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: 2024/04/15 01:31 by solidblock