HeaderAndFooterLayout.java
net.minecraft.client.gui.layouts.HeaderAndFooterLayout
信息
- 全限定名:net.minecraft.client.gui.layouts.HeaderAndFooterLayout
- 类型:public class
- 包:net.minecraft.client.gui.layouts
- 源码路径:src/main/java/net/minecraft/client/gui/layouts/HeaderAndFooterLayout.java
- 起始行号:L12
- 实现:Layout
- 职责:
TODO
字段/常量
-
MAGIC_PADDING- 类型:
int - 修饰符:
public static final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
DEFAULT_HEADER_AND_FOOTER_HEIGHT- 类型:
int - 修饰符:
public static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
CONTENT_MARGIN_TOP- 类型:
int - 修饰符:
private static final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
headerFrame- 类型:
FrameLayout - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
footerFrame- 类型:
FrameLayout - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
contentsFrame- 类型:
FrameLayout - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
screen- 类型:
Screen - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
headerHeight- 类型:
int - 修饰符:
private - 源码定位:
L20 - 说明:
TODO
- 类型:
-
footerHeight- 类型:
int - 修饰符:
private - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public HeaderAndFooterLayout(Screen screen) @ L23
- 构造器名:HeaderAndFooterLayout
- 源码定位:L23
- 修饰符:public
参数:
- screen: Screen
说明:
TODO
public HeaderAndFooterLayout(Screen screen, int headerAndFooterHeight) @ L27
- 构造器名:HeaderAndFooterLayout
- 源码定位:L27
- 修饰符:public
参数:
- screen: Screen
- headerAndFooterHeight: int
说明:
TODO
public HeaderAndFooterLayout(Screen screen, int headerHeight, int footerHeight) @ L31
- 构造器名:HeaderAndFooterLayout
- 源码定位:L31
- 修饰符:public
参数:
- screen: Screen
- headerHeight: int
- footerHeight: int
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void setX(int x) @ L39
- 方法名:setX
- 源码定位:L39
- 返回类型:void
- 修饰符:public
参数:
- x: int
说明:
TODO
public void setY(int y) @ L43
- 方法名:setY
- 源码定位:L43
- 返回类型:void
- 修饰符:public
参数:
- y: int
说明:
TODO
public int getX() @ L47
- 方法名:getX
- 源码定位:L47
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getY() @ L52
- 方法名:getY
- 源码定位:L52
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getWidth() @ L57
- 方法名:getWidth
- 源码定位:L57
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getHeight() @ L62
- 方法名:getHeight
- 源码定位:L62
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getFooterHeight() @ L67
- 方法名:getFooterHeight
- 源码定位:L67
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public void setFooterHeight(int footerHeight) @ L71
- 方法名:setFooterHeight
- 源码定位:L71
- 返回类型:void
- 修饰符:public
参数:
- footerHeight: int
说明:
TODO
public void setHeaderHeight(int headerHeight) @ L75
- 方法名:setHeaderHeight
- 源码定位:L75
- 返回类型:void
- 修饰符:public
参数:
- headerHeight: int
说明:
TODO
public int getHeaderHeight() @ L79
- 方法名:getHeaderHeight
- 源码定位:L79
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getContentHeight() @ L83
- 方法名:getContentHeight
- 源码定位:L83
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public void visitChildren(Consumer<LayoutElement> layoutElementVisitor) @ L87
- 方法名:visitChildren
- 源码定位:L87
- 返回类型:void
- 修饰符:public
参数:
- layoutElementVisitor: Consumer
说明:
TODO
public void arrangeElements() @ L94
- 方法名:arrangeElements
- 源码定位:L94
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public <T extends LayoutElement> T addToHeader(T child) @ L113
- 方法名:addToHeader
- 源码定位:L113
- 返回类型:
T - 修饰符:public
参数:
- child: T
说明:
TODO
public <T extends LayoutElement> T addToHeader(T child, Consumer<LayoutSettings> layoutSettingsAdjustments) @ L117
- 方法名:addToHeader
- 源码定位:L117
- 返回类型:
T - 修饰符:public
参数:
- child: T
- layoutSettingsAdjustments: Consumer
说明:
TODO
public void addTitleHeader(Component component, Font font) @ L121
- 方法名:addTitleHeader
- 源码定位:L121
- 返回类型:void
- 修饰符:public
参数:
- component: Component
- font: Font
说明:
TODO
public <T extends LayoutElement> T addToFooter(T child) @ L125
- 方法名:addToFooter
- 源码定位:L125
- 返回类型:
T - 修饰符:public
参数:
- child: T
说明:
TODO
public <T extends LayoutElement> T addToFooter(T child, Consumer<LayoutSettings> layoutSettingsAdjustments) @ L129
- 方法名:addToFooter
- 源码定位:L129
- 返回类型:
T - 修饰符:public
参数:
- child: T
- layoutSettingsAdjustments: Consumer
说明:
TODO
public <T extends LayoutElement> T addToContents(T child) @ L133
- 方法名:addToContents
- 源码定位:L133
- 返回类型:
T - 修饰符:public
参数:
- child: T
说明:
TODO
public <T extends LayoutElement> T addToContents(T child, Consumer<LayoutSettings> layoutSettingsAdjustments) @ L137
- 方法名:addToContents
- 源码定位:L137
- 返回类型:
T - 修饰符:public
参数:
- child: T
- layoutSettingsAdjustments: Consumer
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class HeaderAndFooterLayout implements Layout {
public static final int MAGIC_PADDING = 13;
public static final int DEFAULT_HEADER_AND_FOOTER_HEIGHT = 33;
private static final int CONTENT_MARGIN_TOP = 30;
private final FrameLayout headerFrame = new FrameLayout();
private final FrameLayout footerFrame = new FrameLayout();
private final FrameLayout contentsFrame = new FrameLayout();
private final Screen screen;
private int headerHeight;
private int footerHeight;
public HeaderAndFooterLayout(Screen screen) {
this(screen, 33);
}
public HeaderAndFooterLayout(Screen screen, int headerAndFooterHeight) {
this(screen, headerAndFooterHeight, headerAndFooterHeight);
}
public HeaderAndFooterLayout(Screen screen, int headerHeight, int footerHeight) {
this.screen = screen;
this.headerHeight = headerHeight;
this.footerHeight = footerHeight;
this.headerFrame.defaultChildLayoutSetting().align(0.5F, 0.5F);
this.footerFrame.defaultChildLayoutSetting().align(0.5F, 0.5F);
}
@Override
public void setX(int x) {
}
@Override
public void setY(int y) {
}
@Override
public int getX() {
return 0;
}
@Override
public int getY() {
return 0;
}
@Override
public int getWidth() {
return this.screen.width;
}
@Override
public int getHeight() {
return this.screen.height;
}
public int getFooterHeight() {
return this.footerHeight;
}
public void setFooterHeight(int footerHeight) {
this.footerHeight = footerHeight;
}
public void setHeaderHeight(int headerHeight) {
this.headerHeight = headerHeight;
}
public int getHeaderHeight() {
return this.headerHeight;
}
public int getContentHeight() {
return this.screen.height - this.getHeaderHeight() - this.getFooterHeight();
}
@Override
public void visitChildren(Consumer<LayoutElement> layoutElementVisitor) {
this.headerFrame.visitChildren(layoutElementVisitor);
this.contentsFrame.visitChildren(layoutElementVisitor);
this.footerFrame.visitChildren(layoutElementVisitor);
}
@Override
public void arrangeElements() {
int headerHeight = this.getHeaderHeight();
int footerHeight = this.getFooterHeight();
this.headerFrame.setMinWidth(this.screen.width);
this.headerFrame.setMinHeight(headerHeight);
this.headerFrame.setPosition(0, 0);
this.headerFrame.arrangeElements();
this.footerFrame.setMinWidth(this.screen.width);
this.footerFrame.setMinHeight(footerHeight);
this.footerFrame.arrangeElements();
this.footerFrame.setY(this.screen.height - footerHeight);
this.contentsFrame.setMinWidth(this.screen.width);
this.contentsFrame.arrangeElements();
int preferredContentY = headerHeight + 30;
int maxContentY = this.screen.height - footerHeight - this.contentsFrame.getHeight();
this.contentsFrame.setPosition(0, Math.min(preferredContentY, maxContentY));
}
public <T extends LayoutElement> T addToHeader(T child) {
return this.headerFrame.addChild(child);
}
public <T extends LayoutElement> T addToHeader(T child, Consumer<LayoutSettings> layoutSettingsAdjustments) {
return this.headerFrame.addChild(child, layoutSettingsAdjustments);
}
public void addTitleHeader(Component component, Font font) {
this.headerFrame.addChild(new StringWidget(component, font));
}
public <T extends LayoutElement> T addToFooter(T child) {
return this.footerFrame.addChild(child);
}
public <T extends LayoutElement> T addToFooter(T child, Consumer<LayoutSettings> layoutSettingsAdjustments) {
return this.footerFrame.addChild(child, layoutSettingsAdjustments);
}
public <T extends LayoutElement> T addToContents(T child) {
return this.contentsFrame.addChild(child);
}
public <T extends LayoutElement> T addToContents(T child, Consumer<LayoutSettings> layoutSettingsAdjustments) {
return this.contentsFrame.addChild(child, layoutSettingsAdjustments);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
StringWidget()
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
FrameLayout()
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置: