FileFixerAbortedScreen.java

net.minecraft.client.gui.screens.FileFixerAbortedScreen

信息

  • 全限定名:net.minecraft.client.gui.screens.FileFixerAbortedScreen
  • 类型:public class
  • 包:net.minecraft.client.gui.screens
  • 源码路径:src/main/java/net/minecraft/client/gui/screens/FileFixerAbortedScreen.java
  • 起始行号:L17
  • 继承:Screen
  • 职责:

    TODO

字段/常量

  • layout

    • 类型: LinearLayout
    • 修饰符: protected final
    • 源码定位: L18
    • 说明:

      TODO

  • message

    • 类型: Component
    • 修饰符: private final
    • 源码定位: L19
    • 说明:

      TODO

  • backButton

    • 类型: Button
    • 修饰符: protected
    • 源码定位: L20
    • 说明:

      TODO

  • reportBugButton

    • 类型: Button
    • 修饰符: protected
    • 源码定位: L21
    • 说明:

      TODO

  • callback

    • 类型: Runnable
    • 修饰符: protected final
    • 源码定位: L22
    • 说明:

      TODO

内部类/嵌套类型

构造器

public FileFixerAbortedScreen(Runnable callback, Component message) @ L24

  • 构造器名:FileFixerAbortedScreen
  • 源码定位:L24
  • 修饰符:public

参数:

  • callback: Runnable
  • message: Component

说明:

TODO

方法

下面的方法块按源码顺序生成。

public Component getNarrationMessage() @ L30

  • 方法名:getNarrationMessage
  • 源码定位:L30
  • 返回类型:Component
  • 修饰符:public

参数:

说明:

TODO

protected void init() @ L35

  • 方法名:init
  • 源码定位:L35
  • 返回类型:void
  • 修饰符:protected

参数:

说明:

TODO

protected void repositionElements() @ L48

  • 方法名:repositionElements
  • 源码定位:L48
  • 返回类型:void
  • 修饰符:protected

参数:

说明:

TODO

protected void addButtons(LinearLayout buttonLayout) @ L54

  • 方法名:addButtons
  • 源码定位:L54
  • 返回类型:void
  • 修饰符:protected

参数:

  • buttonLayout: LinearLayout

说明:

TODO

public boolean shouldCloseOnEsc() @ L64

  • 方法名:shouldCloseOnEsc
  • 源码定位:L64
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean keyPressed(KeyEvent event) @ L69

  • 方法名:keyPressed
  • 源码定位:L69
  • 返回类型:boolean
  • 修饰符:public

参数:

  • event: KeyEvent

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class FileFixerAbortedScreen extends Screen {
    protected final LinearLayout layout = LinearLayout.vertical().spacing(8);
    private final Component message;
    protected @Nullable Button backButton;
    protected @Nullable Button reportBugButton;
    protected final Runnable callback;
 
    public FileFixerAbortedScreen(Runnable callback, Component message) {
        super(Component.translatable("upgradeWorld.aborted.title"));
        this.callback = callback;
        this.message = message;
    }
 
    @Override
    public Component getNarrationMessage() {
        return CommonComponents.joinForNarration(super.getNarrationMessage(), this.message);
    }
 
    @Override
    protected void init() {
        super.init();
        this.layout.defaultCellSetting().alignHorizontallyCenter();
        this.layout.addChild(new StringWidget(this.title, this.font));
        this.layout.addChild(new MultiLineTextWidget(this.message, this.font).setMaxWidth(this.width - 50).setMaxRows(15).setCentered(true));
        LinearLayout buttonLayout = this.layout.addChild(LinearLayout.horizontal().spacing(4));
        buttonLayout.defaultCellSetting().paddingTop(16);
        this.addButtons(buttonLayout);
        this.layout.visitWidgets(this::addRenderableWidget);
        this.repositionElements();
    }
 
    @Override
    protected void repositionElements() {
        this.layout.arrangeElements();
        FrameLayout.centerInRectangle(this.layout, this.getRectangle());
    }
 
    protected void addButtons(LinearLayout buttonLayout) {
        this.backButton = buttonLayout.addChild(Button.builder(CommonComponents.GUI_BACK, var1 -> this.callback.run()).build());
        this.reportBugButton = buttonLayout.addChild(
            Button.builder(
                    Component.translatable("upgradeWorld.aborted.reportBug"), ConfirmLinkScreen.confirmLink(this, CommonLinks.SNAPSHOT_BUGS_FEEDBACK, true)
                )
                .build()
        );
    }
 
    @Override
    public boolean shouldCloseOnEsc() {
        return false;
    }
 
    @Override
    public boolean keyPressed(KeyEvent event) {
        if (event.isEscape()) {
            this.callback.run();
            return true;
        } else {
            return super.keyPressed(event);
        }
    }
}

引用的其他类

  • Button

    • 引用位置: 字段/方法调用
    • 关联成员: Button.builder()
  • MultiLineTextWidget

    • 引用位置: 构造调用
    • 关联成员: MultiLineTextWidget()
  • StringWidget

    • 引用位置: 构造调用
    • 关联成员: StringWidget()
  • FrameLayout

    • 引用位置: 方法调用
    • 关联成员: FrameLayout.centerInRectangle()
  • LinearLayout

    • 引用位置: 参数/字段/方法调用
    • 关联成员: LinearLayout.horizontal(), LinearLayout.vertical()
  • ConfirmLinkScreen

    • 引用位置: 方法调用
    • 关联成员: ConfirmLinkScreen.confirmLink()
  • Screen

    • 引用位置: 继承
  • KeyEvent

    • 引用位置: 参数
  • CommonComponents

    • 引用位置: 方法调用
    • 关联成员: CommonComponents.joinForNarration()
  • Component

    • 引用位置: 参数/字段/方法调用/返回值
    • 关联成员: Component.translatable()