GridLayoutTab.java

net.minecraft.client.gui.components.tabs.GridLayoutTab

信息

  • 全限定名:net.minecraft.client.gui.components.tabs.GridLayoutTab
  • 类型:public class
  • 包:net.minecraft.client.gui.components.tabs
  • 源码路径:src/main/java/net/minecraft/client/gui/components/tabs/GridLayoutTab.java
  • 起始行号:L13
  • 实现:Tab
  • 职责:

    TODO

字段/常量

  • title

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

      TODO

  • layout

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

      TODO

内部类/嵌套类型

构造器

public GridLayoutTab(Component title) @ L17

  • 构造器名:GridLayoutTab
  • 源码定位:L17
  • 修饰符:public

参数:

  • title: Component

说明:

TODO

方法

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

public Component getTabTitle() @ L21

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

参数:

说明:

TODO

public Component getTabExtraNarration() @ L26

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

参数:

说明:

TODO

public void visitChildren(Consumer<AbstractWidget> childrenConsumer) @ L31

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

参数:

  • childrenConsumer: Consumer

说明:

TODO

public void doLayout(ScreenRectangle screenRectangle) @ L36

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

参数:

  • screenRectangle: ScreenRectangle

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GridLayoutTab implements Tab {
    private final Component title;
    protected final GridLayout layout = new GridLayout();
 
    public GridLayoutTab(Component title) {
        this.title = title;
    }
 
    @Override
    public Component getTabTitle() {
        return this.title;
    }
 
    @Override
    public Component getTabExtraNarration() {
        return Component.empty();
    }
 
    @Override
    public void visitChildren(Consumer<AbstractWidget> childrenConsumer) {
        this.layout.visitWidgets(childrenConsumer);
    }
 
    @Override
    public void doLayout(ScreenRectangle screenRectangle) {
        this.layout.arrangeElements();
        FrameLayout.alignInRectangle(this.layout, screenRectangle, 0.5F, 0.16666667F);
    }
}

引用的其他类

  • AbstractWidget

    • 引用位置: 参数
  • Tab

    • 引用位置: 实现
  • FrameLayout

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

    • 引用位置: 字段/构造调用
    • 关联成员: GridLayout()
  • ScreenRectangle

    • 引用位置: 参数
  • Component

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