zh_cn:tutorial:screen
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zh_cn:tutorial:screen [2023/04/24 08:33] – [滚动] solidblock | zh_cn:tutorial:screen [2023/12/18 01:40] (current) – [添加文本] solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== 添加屏幕 ====== | ====== 添加屏幕 ====== | ||
- | **屏幕**是指的图形用户界面,其类继承了 '' | + | **屏幕**是指的图形用户界面,其类继承了 '' |
你可以使用 mixin 以在现有的屏幕中,加入你的屏幕的链接。但是很多情况下,我们可以实现 Mod Menu 模组中的 '' | 你可以使用 mixin 以在现有的屏幕中,加入你的屏幕的链接。但是很多情况下,我们可以实现 Mod Menu 模组中的 '' | ||
Line 124: | Line 124: | ||
在 '' | 在 '' | ||
<code java> | <code java> | ||
+ | // 对于 1.20 以下版本 | ||
@Override | @Override | ||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { | public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { | ||
super.render(matrices, | super.render(matrices, | ||
drawCenteredTextWithShadow(matrices, | drawCenteredTextWithShadow(matrices, | ||
+ | } | ||
+ | |||
+ | // 对于 1.20 及以上的版本 | ||
+ | @Override | ||
+ | public void render(DrawContext context, int mouseX, int mouseY, float delta) { | ||
+ | super.render(context, | ||
+ | context.drawCenteredTextWithShadow(textRenderer, | ||
} | } | ||
</ | </ | ||
Line 134: | Line 142: | ||
<code java> | <code java> | ||
final MultilineText multilineText = MultilineText.create(textRenderer, | final MultilineText multilineText = MultilineText.create(textRenderer, | ||
+ | | ||
+ | // 对于 1.20 以下版本 | ||
multilineText.drawWithShadow(matrices, | multilineText.drawWithShadow(matrices, | ||
+ | // 对于 1.20 及以下的版本 | ||
+ | multilineText.drawWithShadow(context, | ||
</ | </ | ||
Line 145: | Line 157: | ||
===== 完成之前需要检查的事情 ===== | ===== 完成之前需要检查的事情 ===== | ||
- | After finishing your screen, in order to avoid potential issues, please check: | + | 在完成你的屏幕之后,为避免潜在的问题,请检查: |
- | * whether the screen returns to the last screen (parent screen) when you press "Esc" | + | * 按下 |
- | * whether these classes exist only on client (which means they will not be loaded in the dedicated server) | + | * 这些类是否仅存在于客户端(也就是说在专用服务器上不会加载) |
- | * whether elements are focused in the correct order when you press "Tab" to select them | + | * 按下 |
- | * whether the behaviors are correct when you resize | + | * 重新调整屏幕尺寸时的行为是否正确 |
- | * whether the narrations are correct when you use "Tab" or mouse cursor to select element while narration enabled | + | * 启用了复述功能时,按下 |
zh_cn/tutorial/screen.1682325201.txt.gz · Last modified: 2023/04/24 08:33 by solidblock