ServerReconfigScreen.java
net.minecraft.client.gui.screens.multiplayer.ServerReconfigScreen
信息
- 全限定名:net.minecraft.client.gui.screens.multiplayer.ServerReconfigScreen
- 类型:public class
- 包:net.minecraft.client.gui.screens.multiplayer
- 源码路径:src/main/java/net/minecraft/client/gui/screens/multiplayer/ServerReconfigScreen.java
- 起始行号:L16
- 继承:Screen
- 职责:
TODO
字段/常量
-
DISCONNECT_TIME- 类型:
int - 修饰符:
private static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
connection- 类型:
Connection - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
disconnectButton- 类型:
Button - 修饰符:
private - 源码定位:
L19 - 说明:
TODO
- 类型:
-
delayTicker- 类型:
int - 修饰符:
private - 源码定位:
L20 - 说明:
TODO
- 类型:
-
layout- 类型:
LinearLayout - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ServerReconfigScreen(Component title, Connection connection) @ L23
- 构造器名:ServerReconfigScreen
- 源码定位:L23
- 修饰符:public
参数:
- title: Component
- connection: Connection
说明:
TODO
方法
下面的方法块按源码顺序生成。
public boolean shouldCloseOnEsc() @ L28
- 方法名:shouldCloseOnEsc
- 源码定位:L28
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
protected void init() @ L33
- 方法名:init
- 源码定位:L33
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
protected void repositionElements() @ L45
- 方法名:repositionElements
- 源码定位:L45
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public void tick() @ L50
- 方法名:tick
- 源码定位:L50
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class ServerReconfigScreen extends Screen {
private static final int DISCONNECT_TIME = 600;
private final Connection connection;
private Button disconnectButton;
private int delayTicker;
private final LinearLayout layout = LinearLayout.vertical();
public ServerReconfigScreen(Component title, Connection connection) {
super(title);
this.connection = connection;
}
@Override
public boolean shouldCloseOnEsc() {
return false;
}
@Override
protected void init() {
this.layout.defaultCellSetting().alignHorizontallyCenter().padding(10);
this.layout.addChild(new StringWidget(this.title, this.font));
this.disconnectButton = this.layout
.addChild(Button.builder(CommonComponents.GUI_DISCONNECT, b -> this.connection.disconnect(ConnectScreen.ABORT_CONNECTION)).build());
this.disconnectButton.active = false;
this.layout.arrangeElements();
this.layout.visitWidgets(x$0 -> this.addRenderableWidget(x$0));
this.repositionElements();
}
@Override
protected void repositionElements() {
FrameLayout.centerInRectangle(this.layout, this.getRectangle());
}
@Override
public void tick() {
super.tick();
this.delayTicker++;
if (this.delayTicker == 600) {
this.disconnectButton.active = true;
}
if (this.connection.isConnected()) {
this.connection.tick();
} else {
this.connection.handleDisconnection();
}
}
}引用的其他类
-
- 引用位置:
字段/方法调用 - 关联成员:
Button.builder()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
StringWidget()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
FrameLayout.centerInRectangle()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
LinearLayout.vertical()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置: