tutorial:tooltip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:tooltip [2021/02/22 00:30] – Fix some formatting/typos proudmuslim | tutorial:tooltip [2022/12/16 00:21] (current) – solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Adding a tooltip ====== | ====== Adding a tooltip ====== | ||
- | In your [[tutorial: | + | In your [[tutorial: |
- | <code java> | + | |
+ | For versions 1.18.2 and before: | ||
+ | <yarncode | ||
@Override | @Override | ||
- | public void appendTooltip(ItemStack | + | public void method_7851(class_1799 |
// default white text | // default white text | ||
- | tooltip.add( new TranslatableText(" | + | tooltip.add(new TranslatableText(" |
- | + | ||
// formatted red text | // formatted red text | ||
- | tooltip.add( new TranslatableText(" | + | tooltip.add(new TranslatableText(" |
} | } | ||
- | </code> | + | </yarncode> |
+ | |||
+ | For versions since 1.19: | ||
+ | < | ||
+ | @Override | ||
+ | public void method_7851(class_1799 itemStack, class_1937 world, List< | ||
+ | |||
+ | // default white text | ||
+ | tooltip.add(Text.translatable(" | ||
+ | |||
+ | // formatted red text | ||
+ | tooltip.add(Text.translatable(" | ||
+ | } | ||
+ | </ | ||
You can also append your tooltip in the [[tutorial: | You can also append your tooltip in the [[tutorial: | ||
- | <code java> | + | <yarncode |
@Override | @Override | ||
- | public void appendTooltip(ItemStack | + | public void method_9568(class_1799 |
- | tooltip.add( new TranslatableText(" | + | // for versions 1.18.2 and before |
+ | tooltip.add(new TranslatableText(" | ||
+ | |||
+ | // for versions since 1.19 | ||
+ | tooltip.add(Text.translatable(" | ||
} | } | ||
- | </code> | + | </yarncode> |
tutorial/tooltip.1613953801.txt.gz · Last modified: 2021/02/22 00:30 by proudmuslim