ButtonListDialogScreen.java

net.minecraft.client.gui.screens.dialog.ButtonListDialogScreen

信息

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

    TODO

字段/常量

  • FOOTER_MARGIN
    • 类型: int
    • 修饰符: public static final
    • 源码定位: L17
    • 说明:

      TODO

内部类/嵌套类型

构造器

public ButtonListDialogScreen(Screen previousScreen, T dialog, DialogConnectionAccess connectionAccess) @ L19

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

参数:

  • previousScreen: Screen
  • dialog: T
  • connectionAccess: DialogConnectionAccess

说明:

TODO

方法

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

protected void populateBodyElements(LinearLayout layout, DialogControlSet controlSet, T dialog, DialogConnectionAccess connectionAccess) @ L23

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

参数:

  • layout: LinearLayout
  • controlSet: DialogControlSet
  • dialog: T
  • connectionAccess: DialogConnectionAccess

说明:

TODO

protected abstract Stream<ActionButton> createListActions(T dialog, DialogConnectionAccess connectionAccess) @ L29

  • 方法名:createListActions
  • 源码定位:L29
  • 返回类型:Stream
  • 修饰符:protected abstract

参数:

  • dialog: T
  • connectionAccess: DialogConnectionAccess

说明:

TODO

protected void updateHeaderAndFooter(HeaderAndFooterLayout layout, DialogControlSet controlSet, T dialog, DialogConnectionAccess connectionAccess) @ L31

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

参数:

  • layout: HeaderAndFooterLayout
  • controlSet: DialogControlSet
  • dialog: T
  • connectionAccess: DialogConnectionAccess

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class ButtonListDialogScreen<T extends ButtonListDialog> extends DialogScreen<T> {
    public static final int FOOTER_MARGIN = 5;
 
    public ButtonListDialogScreen(@Nullable Screen previousScreen, T dialog, DialogConnectionAccess connectionAccess) {
        super(previousScreen, dialog, connectionAccess);
    }
 
    protected void populateBodyElements(LinearLayout layout, DialogControlSet controlSet, T dialog, DialogConnectionAccess connectionAccess) {
        super.populateBodyElements(layout, controlSet, dialog, connectionAccess);
        List<Button> buttons = this.createListActions(dialog, connectionAccess).map(d -> controlSet.createActionButton(d).build()).toList();
        layout.addChild(packControlsIntoColumns(buttons, dialog.columns()));
    }
 
    protected abstract Stream<ActionButton> createListActions(T dialog, DialogConnectionAccess connectionAccess);
 
    protected void updateHeaderAndFooter(HeaderAndFooterLayout layout, DialogControlSet controlSet, T dialog, DialogConnectionAccess connectionAccess) {
        super.updateHeaderAndFooter(layout, controlSet, dialog, connectionAccess);
        dialog.exitAction()
            .ifPresentOrElse(exitButton -> layout.addToFooter(controlSet.createActionButton(exitButton).build()), () -> layout.setFooterHeight(5));
    }
}

引用的其他类