RealmsConfirmScreen.java

com.mojang.realmsclient.gui.screens.RealmsConfirmScreen

信息

  • 全限定名:com.mojang.realmsclient.gui.screens.RealmsConfirmScreen
  • 类型:public class
  • 包:com.mojang.realmsclient.gui.screens
  • 源码路径:src/main/java/com/mojang/realmsclient/gui/screens/RealmsConfirmScreen.java
  • 起始行号:L14
  • 继承:RealmsScreen
  • 职责:

    TODO

字段/常量

  • callback

    • 类型: BooleanConsumer
    • 修饰符: protected final
    • 源码定位: L15
    • 说明:

      TODO

  • title1

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

      TODO

  • title2

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

      TODO

内部类/嵌套类型

构造器

public RealmsConfirmScreen(BooleanConsumer callback, Component title1, Component title2) @ L19

  • 构造器名:RealmsConfirmScreen
  • 源码定位:L19
  • 修饰符:public

参数:

  • callback: BooleanConsumer
  • title1: Component
  • title2: Component

说明:

TODO

方法

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

public void init() @ L26

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

参数:

说明:

TODO

public void extractRenderState(GuiGraphicsExtractor graphics, int xm, int ym, float a) @ L36

  • 方法名:extractRenderState
  • 源码定位:L36
  • 返回类型:void
  • 修饰符:public

参数:

  • graphics: GuiGraphicsExtractor
  • xm: int
  • ym: int
  • a: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class RealmsConfirmScreen extends RealmsScreen {
    protected final BooleanConsumer callback;
    private final Component title1;
    private final Component title2;
 
    public RealmsConfirmScreen(BooleanConsumer callback, Component title1, Component title2) {
        super(GameNarrator.NO_TITLE);
        this.callback = callback;
        this.title1 = title1;
        this.title2 = title2;
    }
 
    @Override
    public void init() {
        this.addRenderableWidget(
            Button.builder(CommonComponents.GUI_YES, button -> this.callback.accept(true)).bounds(this.width / 2 - 105, row(9), 100, 20).build()
        );
        this.addRenderableWidget(
            Button.builder(CommonComponents.GUI_NO, button -> this.callback.accept(false)).bounds(this.width / 2 + 5, row(9), 100, 20).build()
        );
    }
 
    @Override
    public void extractRenderState(GuiGraphicsExtractor graphics, int xm, int ym, float a) {
        super.extractRenderState(graphics, xm, ym, a);
        graphics.centeredText(this.font, this.title1, this.width / 2, row(3), -1);
        graphics.centeredText(this.font, this.title2, this.width / 2, row(5), -1);
    }
}

引用的其他类