BackupConfirmScreen.java
net.minecraft.client.gui.screens.BackupConfirmScreen
信息
- 全限定名:net.minecraft.client.gui.screens.BackupConfirmScreen
- 类型:public class
- 包:net.minecraft.client.gui.screens
- 源码路径:src/main/java/net/minecraft/client/gui/screens/BackupConfirmScreen.java
- 起始行号:L16
- 继承:Screen
- 职责:
TODO
字段/常量
-
SKIP_AND_JOIN- 类型:
Component - 修饰符:
private static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
BACKUP_AND_JOIN- 类型:
Component - 修饰符:
public static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
onCancel- 类型:
Runnable - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
onProceed- 类型:
BackupConfirmScreen.Listener - 修饰符:
protected final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
description- 类型:
Component - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
promptForCacheErase- 类型:
boolean - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
message- 类型:
MultiLineLabel - 修饰符:
private - 源码定位:
L23 - 说明:
TODO
- 类型:
-
confirmation- 类型:
Component - 修饰符:
final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
id- 类型:
int - 修饰符:
protected - 源码定位:
L25 - 说明:
TODO
- 类型:
-
eraseCache- 类型:
Checkbox - 修饰符:
private - 源码定位:
L26 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.gui.screens.BackupConfirmScreen.Listener- 类型:
interface - 修饰符:
public - 源码定位:
L93 - 说明:
TODO
- 类型:
构造器
public BackupConfirmScreen(Runnable onCancel, BackupConfirmScreen.Listener onProceed, Component title, Component description, boolean promptForCacheErase) @ L28
- 构造器名:BackupConfirmScreen
- 源码定位:L28
- 修饰符:public
参数:
- onCancel: Runnable
- onProceed: BackupConfirmScreen.Listener
- title: Component
- description: Component
- promptForCacheErase: boolean
说明:
TODO
public BackupConfirmScreen(Runnable onCancel, BackupConfirmScreen.Listener onProceed, Component title, Component description, Component confirmation, boolean promptForCacheErase) @ L32
- 构造器名:BackupConfirmScreen
- 源码定位:L32
- 修饰符:public
参数:
- onCancel: Runnable
- onProceed: BackupConfirmScreen.Listener
- title: Component
- description: Component
- confirmation: Component
- promptForCacheErase: boolean
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected void init() @ L43
- 方法名:init
- 源码定位:L43
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) @ L69
- 方法名:extractRenderState
- 源码定位:L69
- 返回类型:void
- 修饰符:public
参数:
- graphics: GuiGraphicsExtractor
- mouseX: int
- mouseY: int
- a: float
说明:
TODO
public boolean shouldCloseOnEsc() @ L77
- 方法名:shouldCloseOnEsc
- 源码定位:L77
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean keyPressed(KeyEvent event) @ L82
- 方法名:keyPressed
- 源码定位:L82
- 返回类型:boolean
- 修饰符:public
参数:
- event: KeyEvent
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class BackupConfirmScreen extends Screen {
private static final Component SKIP_AND_JOIN = Component.translatable("selectWorld.backupJoinSkipButton");
public static final Component BACKUP_AND_JOIN = Component.translatable("selectWorld.backupJoinConfirmButton");
private final Runnable onCancel;
protected final BackupConfirmScreen.Listener onProceed;
private final Component description;
private final boolean promptForCacheErase;
private MultiLineLabel message = MultiLineLabel.EMPTY;
final Component confirmation;
protected int id;
private Checkbox eraseCache;
public BackupConfirmScreen(Runnable onCancel, BackupConfirmScreen.Listener onProceed, Component title, Component description, boolean promptForCacheErase) {
this(onCancel, onProceed, title, description, BACKUP_AND_JOIN, promptForCacheErase);
}
public BackupConfirmScreen(
Runnable onCancel, BackupConfirmScreen.Listener onProceed, Component title, Component description, Component confirmation, boolean promptForCacheErase
) {
super(title);
this.onCancel = onCancel;
this.onProceed = onProceed;
this.description = description;
this.promptForCacheErase = promptForCacheErase;
this.confirmation = confirmation;
}
@Override
protected void init() {
super.init();
this.message = MultiLineLabel.create(this.font, this.description, this.width - 50);
int textSize = (this.message.getLineCount() + 1) * 9;
this.eraseCache = Checkbox.builder(Component.translatable("selectWorld.backupEraseCache").withColor(-2039584), this.font)
.pos(this.width / 2 - 155 + 80, 76 + textSize)
.build();
if (this.promptForCacheErase) {
this.addRenderableWidget(this.eraseCache);
}
this.addRenderableWidget(
Button.builder(this.confirmation, button -> this.onProceed.proceed(true, this.eraseCache.selected()))
.bounds(this.width / 2 - 155, 100 + textSize, 150, 20)
.build()
);
Button skipAndJoinButton = Button.builder(SKIP_AND_JOIN, button -> this.onProceed.proceed(false, this.eraseCache.selected()))
.bounds(this.width / 2 - 155 + 160, 100 + textSize, 150, 20)
.build();
this.addRenderableWidget(skipAndJoinButton);
this.addRenderableWidget(
Button.builder(CommonComponents.GUI_CANCEL, button -> this.onCancel.run()).bounds(this.width / 2 - 155 + 80, 124 + textSize, 150, 20).build()
);
}
@Override
public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
super.extractRenderState(graphics, mouseX, mouseY, a);
ActiveTextCollector textRenderer = graphics.textRenderer();
graphics.centeredText(this.font, this.title, this.width / 2, 50, -1);
this.message.visitLines(TextAlignment.CENTER, this.width / 2, 70, 9, textRenderer);
}
@Override
public boolean shouldCloseOnEsc() {
return false;
}
@Override
public boolean keyPressed(KeyEvent event) {
if (event.isEscape()) {
this.onCancel.run();
return true;
} else {
return super.keyPressed(event);
}
}
@OnlyIn(Dist.CLIENT)
public interface Listener {
void proceed(final boolean backup, final boolean eraseCache);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Button.builder()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
Checkbox.builder()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
MultiLineLabel.create()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/方法调用 - 关联成员:
Component.translatable()
- 引用位置: