GenericMessageScreen.java

net.minecraft.client.gui.screens.GenericMessageScreen

信息

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

    TODO

字段/常量

  • textWidget
    • 类型: FocusableTextWidget
    • 修饰符: private
    • 源码定位: L12
    • 说明:

      TODO

内部类/嵌套类型

构造器

public GenericMessageScreen(Component title) @ L14

  • 构造器名:GenericMessageScreen
  • 源码定位:L14
  • 修饰符:public

参数:

  • title: Component

说明:

TODO

方法

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

protected void init() @ L18

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

参数:

说明:

TODO

protected void repositionElements() @ L24

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

参数:

说明:

TODO

public boolean shouldCloseOnEsc() @ L31

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

参数:

说明:

TODO

protected boolean shouldNarrateNavigation() @ L36

  • 方法名:shouldNarrateNavigation
  • 源码定位:L36
  • 返回类型:boolean
  • 修饰符:protected

参数:

说明:

TODO

public void extractBackground(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) @ L41

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

参数:

  • graphics: GuiGraphicsExtractor
  • mouseX: int
  • mouseY: int
  • a: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GenericMessageScreen extends Screen {
    private @Nullable FocusableTextWidget textWidget;
 
    public GenericMessageScreen(Component title) {
        super(title);
    }
 
    @Override
    protected void init() {
        this.textWidget = this.addRenderableWidget(FocusableTextWidget.builder(this.title, this.font, 12).textWidth(this.font.width(this.title)).build());
        this.repositionElements();
    }
 
    @Override
    protected void repositionElements() {
        if (this.textWidget != null) {
            this.textWidget.setPosition(this.width / 2 - this.textWidget.getWidth() / 2, this.height / 2 - 9 / 2);
        }
    }
 
    @Override
    public boolean shouldCloseOnEsc() {
        return false;
    }
 
    @Override
    protected boolean shouldNarrateNavigation() {
        return false;
    }
 
    @Override
    public void extractBackground(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
        this.extractPanorama(graphics, a);
        this.extractBlurredBackground(graphics);
        this.extractMenuBackground(graphics);
    }
}

引用的其他类