tutorial:tooltip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorial:tooltip [2024/08/23 13:10] – solidblock | tutorial:tooltip [2025/04/01 08:15] (current) – (not moved totally because it's not a separate page on docs and it does not include old versions) solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~REDIRECT> | ||
- | |||
====== Adding a tooltip ====== | ====== Adding a tooltip ====== | ||
===== Item tooltip ===== | ===== Item tooltip ===== | ||
Line 47: | Line 45: | ||
} | } | ||
</ | </ | ||
+ | > :!: The method is deprectaed since 1.21.5. To add item tooltips for 1.21.5, please use Fabric API. | ||
===== Block tooltip ===== | ===== Block tooltip ===== | ||
Line 67: | Line 66: | ||
</ | </ | ||
- | For versions since 1.20.5: | + | For versions since 1.20.5, before 1.21.5: |
< | < | ||
public class CustomBlock extends Block { | public class CustomBlock extends Block { | ||
Line 78: | Line 77: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Adding tooltips in 1.21.5 ===== | ||
+ | |||
+ | Since 1.21.5, the implementation of item tooltips are rewritten. Most item tooltips are implemented with item components now, which may be influenced by '' | ||
+ | <code java> | ||
+ | ItemTooltipCallback.EVENT.register((itemStack, | ||
+ | if (!itemStack.isOf(TutorialItems.CUSTOM_ITEM)) { | ||
+ | return; | ||
+ | } | ||
+ | list.add(Text.translatable(" | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | The example adds a custom tooltip for the item we created in the [[items]] tutorial. |
tutorial/tooltip.txt · Last modified: 2025/04/01 08:15 by solidblock