WarningScreen.java
net.minecraft.client.gui.screens.multiplayer.WarningScreen
信息
- 全限定名:net.minecraft.client.gui.screens.multiplayer.WarningScreen
- 类型:public abstract class
- 包:net.minecraft.client.gui.screens.multiplayer
- 源码路径:src/main/java/net/minecraft/client/gui/screens/multiplayer/WarningScreen.java
- 起始行号:L16
- 继承:Screen
- 职责:
TODO
字段/常量
-
MESSAGE_PADDING- 类型:
int - 修饰符:
private static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
message- 类型:
Component - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
check- 类型:
Component - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
narration- 类型:
Component - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
stopShowing- 类型:
Checkbox - 修饰符:
protected - 源码定位:
L21 - 说明:
TODO
- 类型:
-
messageWidget- 类型:
FittingMultiLineTextWidget - 修饰符:
private - 源码定位:
L22 - 说明:
TODO
- 类型:
-
layout- 类型:
FrameLayout - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
protected WarningScreen(Component title, Component message, Component narration) @ L25
- 构造器名:WarningScreen
- 源码定位:L25
- 修饰符:protected
参数:
- title: Component
- message: Component
- narration: Component
说明:
TODO
protected WarningScreen(Component title, Component message, Component check, Component narration) @ L29
- 构造器名:WarningScreen
- 源码定位:L29
- 修饰符:protected
参数:
- title: Component
- message: Component
- check: Component
- narration: Component
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected abstract Layout addFooterButtons() @ L37
- 方法名:addFooterButtons
- 源码定位:L37
- 返回类型:Layout
- 修饰符:protected abstract
参数:
- 无
说明:
TODO
protected void init() @ L39
- 方法名:init
- 源码定位:L39
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
protected void repositionElements() @ L58
- 方法名:repositionElements
- 源码定位:L58
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public Component getNarrationMessage() @ L70
- 方法名:getNarrationMessage
- 源码定位:L70
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public abstract class WarningScreen extends Screen {
private static final int MESSAGE_PADDING = 100;
private final Component message;
private final @Nullable Component check;
private final Component narration;
protected @Nullable Checkbox stopShowing;
private @Nullable FittingMultiLineTextWidget messageWidget;
private final FrameLayout layout;
protected WarningScreen(Component title, Component message, Component narration) {
this(title, message, null, narration);
}
protected WarningScreen(Component title, Component message, @Nullable Component check, Component narration) {
super(title);
this.message = message;
this.check = check;
this.narration = narration;
this.layout = new FrameLayout(0, 0, this.width, this.height);
}
protected abstract Layout addFooterButtons();
@Override
protected void init() {
LinearLayout content = this.layout.addChild(LinearLayout.vertical().spacing(8));
content.defaultCellSetting().alignHorizontallyCenter();
content.addChild(new StringWidget(this.getTitle(), this.font));
this.messageWidget = content.addChild(
new FittingMultiLineTextWidget(0, 0, this.width - 100, this.height - 100, this.message, this.font), s -> s.padding(12)
);
LinearLayout footer = content.addChild(LinearLayout.vertical().spacing(8));
footer.defaultCellSetting().alignHorizontallyCenter();
if (this.check != null) {
this.stopShowing = footer.addChild(Checkbox.builder(this.check, this.font).build());
}
footer.addChild(this.addFooterButtons());
this.layout.visitWidgets(x$0 -> this.addRenderableWidget(x$0));
this.repositionElements();
}
@Override
protected void repositionElements() {
if (this.messageWidget != null) {
this.messageWidget.setWidth(this.width - 100);
this.messageWidget.setHeight(this.height - 100);
this.messageWidget.minimizeHeight();
}
this.layout.arrangeElements();
FrameLayout.centerInRectangle(this.layout, this.getRectangle());
}
@Override
public Component getNarrationMessage() {
return this.narration;
}
}引用的其他类
-
- 引用位置:
字段/方法调用 - 关联成员:
Checkbox.builder()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
FittingMultiLineTextWidget()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
StringWidget()
- 引用位置:
-
- 引用位置:
字段/方法调用/构造调用 - 关联成员:
FrameLayout(), FrameLayout.centerInRectangle()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LinearLayout.vertical()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置: