tutorial:tooltip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:tooltip [2022/07/23 19:01] – Renamed 'fabric_item' to 'custom_item' for consistency with previous pages. Also whitespace consistency. darthjake | tutorial:tooltip [2024/04/15 01:31] (current) – solidblock | ||
---|---|---|---|
Line 8: | Line 8: | ||
// default white text | // default white text | ||
- | tooltip.add( new class_2588(" | + | tooltip.add(new |
// formatted red text | // formatted red text | ||
- | tooltip.add( new class_2588(" | + | tooltip.add(new |
} | } | ||
</ | </ | ||
Line 19: | Line 19: | ||
@Override | @Override | ||
public void method_7851(class_1799 itemStack, class_1937 world, List< | public void method_7851(class_1799 itemStack, class_1937 world, List< | ||
- | |||
- | // default white text | ||
tooltip.add(Text.translatable(" | tooltip.add(Text.translatable(" | ||
+ | } | ||
+ | </ | ||
- | // formatted red text | + | For versions since 1.20.5: |
- | tooltip.add(Text.translatable(" | + | < |
+ | @Override | ||
+ | public void method_7851(class_1799 itemStack, TooltipContext context, List< | ||
+ | tooltip.add(Text.translatable(" | ||
} | } | ||
</ | </ | ||
- | You can also append your tooltip in the [[tutorial: | + | You can also append your tooltip in the [[tutorial: |
+ | |||
+ | For versions below 1.20.5: | ||
< | < | ||
@Override | @Override | ||
public void method_9568(class_1799 itemStack, class_1922 world, List< | public void method_9568(class_1799 itemStack, class_1922 world, List< | ||
// for versions 1.18.2 and before | // for versions 1.18.2 and before | ||
- | tooltip.add(new | + | tooltip.add(new |
| | ||
// for versions since 1.19 | // for versions since 1.19 | ||
- | tooltip.add(Text.translatable(" | + | |
+ | } | ||
+ | </ | ||
+ | |||
+ | For versions since 1.20.5: | ||
+ | < | ||
+ | @Override | ||
+ | public void method_9568(class_1799 itemStack, Item.TooltipContext context, List< | ||
+ | | ||
} | } | ||
</ | </ |
tutorial/tooltip.1658602904.txt.gz · Last modified: 2022/07/23 19:01 by darthjake