zh_cn:tutorial:tooltip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zh_cn:tutorial:tooltip [2022/05/27 15:38] – solidblock | zh_cn:tutorial:tooltip [2024/04/15 01:31] (current) – solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== 添加一个物品提示 ====== | ====== 添加一个物品提示 ====== | ||
- | 在您的[[zh_cn: | + | 在您的[[zh_cn: |
对于 1.18.2 及之前的版本: | 对于 1.18.2 及之前的版本: | ||
Line 8: | Line 8: | ||
// 默认为白色文本 | // 默认为白色文本 | ||
- | tooltip.add( new class_2588(" | + | tooltip.add(new |
// 格式化为红色文本 | // 格式化为红色文本 | ||
- | 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< | ||
+ | tooltip.add(Text.translatable(" | ||
+ | } | ||
+ | </ | ||
- | // 默认为白色文本 | + | 对于 1.20.5 之后的版本: |
- | | + | < |
- | + | @Override | |
- | // 格式化为红色文本 | + | public void method_7851(class_1799 itemStack, TooltipContext context, List< |
- | tooltip.add(Text.translatable(" | + | tooltip.add(Text.translatable(" |
} | } | ||
</ | </ | ||
- | 你也可以在[[zh_cn: | + | |
+ | 你也可以在[[zh_cn: | ||
< | < | ||
@Override | @Override | ||
public void method_9568(class_1799 itemStack, class_1922 world, List< | public void method_9568(class_1799 itemStack, class_1922 world, List< | ||
// 对于 1.18.2 及之前的版本 | // 对于 1.18.2 及之前的版本 | ||
- | tooltip.add(new | + | tooltip.add(new |
| | ||
// 对于 1.19 之后的版本 | // 对于 1.19 之后的版本 | ||
- | tooltip.add(Text.translatable(" | + | tooltip.add(Text.translatable(" |
+ | } | ||
+ | </ | ||
+ | |||
+ | 对于 1.20.5 之后的版本: | ||
+ | < | ||
+ | @Override | ||
+ | public void method_9568(class_1799 itemStack, Item.TooltipContext context, List< | ||
+ | tooltip.add(Text.translatable(" | ||
} | } | ||
</ | </ |
zh_cn/tutorial/tooltip.1653665889.txt.gz · Last modified: 2022/05/27 15:38 by solidblock