FileFixerProgressScreen.java
net.minecraft.client.gui.screens.worldselection.FileFixerProgressScreen
信息
- 全限定名:net.minecraft.client.gui.screens.worldselection.FileFixerProgressScreen
- 类型:public class
- 包:net.minecraft.client.gui.screens.worldselection
- 源码路径:src/main/java/net/minecraft/client/gui/screens/worldselection/FileFixerProgressScreen.java
- 起始行号:L14
- 继承:Screen
- 职责:
TODO
字段/常量
-
PROGRESS_BAR_WIDTH- 类型:
int - 修饰符:
private static final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
PROGRESS_BAR_HEIGHT- 类型:
int - 修饰符:
private static final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
LINE_SPACING- 类型:
int - 修饰符:
private static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
SECTION_SPACING- 类型:
int - 修饰符:
private static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
SCANNING- 类型:
Component - 修饰符:
private static final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
upgradeProgress- 类型:
UpgradeProgress - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
cancelButton- 类型:
Button - 修饰符:
private - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public FileFixerProgressScreen(UpgradeProgress upgradeProgress) @ L23
- 构造器名:FileFixerProgressScreen
- 源码定位:L23
- 修饰符:public
参数:
- upgradeProgress: UpgradeProgress
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected void init() @ L28
- 方法名:init
- 源码定位:L28
- 返回类型:void
- 修饰符:protected
参数:
- 无
说明:
TODO
public boolean shouldCloseOnEsc() @ L38
- 方法名:shouldCloseOnEsc
- 源码定位:L38
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) @ L43
- 方法名:extractRenderState
- 源码定位:L43
- 返回类型:void
- 修饰符:public
参数:
- graphics: GuiGraphicsExtractor
- mouseX: int
- mouseY: int
- partialTick: float
说明:
TODO
private void extractTitle(GuiGraphicsExtractor graphics, int xCenter, int yTop) @ L58
- 方法名:extractTitle
- 源码定位:L58
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- yTop: int
说明:
TODO
private void extractProgress(GuiGraphicsExtractor graphics, int xCenter, int textTop) @ L62
- 方法名:extractProgress
- 源码定位:L62
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- textTop: int
说明:
TODO
private void extractProgressBar(GuiGraphicsExtractor graphics, int xCenter, int y, float progress) @ L80
- 方法名:extractProgressBar
- 源码定位:L80
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- y: int
- progress: float
说明:
TODO
private void extractTypeText(GuiGraphicsExtractor graphics, int xCenter, int y) @ L88
- 方法名:extractTypeText
- 源码定位:L88
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- y: int
说明:
TODO
private void extractTypeProgress(GuiGraphicsExtractor graphics, int xCenter, int y, float progress) @ L95
- 方法名:extractTypeProgress
- 源码定位:L95
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- y: int
- progress: float
说明:
TODO
private void extractFileStats(GuiGraphicsExtractor graphics, int xCenter, int yStart, int converted, int total) @ L100
- 方法名:extractFileStats
- 源码定位:L100
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- yStart: int
- converted: int
- total: int
说明:
TODO
private void extractScanning(GuiGraphicsExtractor graphics, int xCenter, int textTop) @ L106
- 方法名:extractScanning
- 源码定位:L106
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- textTop: int
说明:
TODO
private void extractFileFixerCount(GuiGraphicsExtractor graphics, int xCenter, int y, int current, int total) @ L110
- 方法名:extractFileFixerCount
- 源码定位:L110
- 返回类型:void
- 修饰符:private
参数:
- graphics: GuiGraphicsExtractor
- xCenter: int
- y: int
- current: int
- total: int
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class FileFixerProgressScreen extends Screen {
private static final int PROGRESS_BAR_WIDTH = 200;
private static final int PROGRESS_BAR_HEIGHT = 2;
private static final int LINE_SPACING = 3;
private static final int SECTION_SPACING = 30;
private static final Component SCANNING = Component.translatable("upgradeWorld.info.scanning");
private final UpgradeProgress upgradeProgress;
private Button cancelButton;
public FileFixerProgressScreen(UpgradeProgress upgradeProgress) {
super(Component.translatable("upgradeWorld.title"));
this.upgradeProgress = upgradeProgress;
}
@Override
protected void init() {
super.init();
this.cancelButton = Button.builder(CommonComponents.GUI_CANCEL, button -> {
this.upgradeProgress.setCanceled();
button.active = false;
}).bounds((this.width - 200) / 2, this.height / 2 + 100, 200, 20).build();
this.addRenderableWidget(this.cancelButton);
}
@Override
public boolean shouldCloseOnEsc() {
return false;
}
@Override
public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) {
super.extractRenderState(graphics, mouseX, mouseY, partialTick);
int xCenter = this.width / 2;
int yCenter = this.height / 2;
int textTop = yCenter - 50;
this.extractTitle(graphics, xCenter, textTop);
int totalFiles = this.upgradeProgress.getTotalFileFixStats().totalOperations();
if (totalFiles > 0) {
this.extractProgress(graphics, xCenter, textTop);
} else {
this.extractScanning(graphics, xCenter, textTop);
}
}
private void extractTitle(GuiGraphicsExtractor graphics, int xCenter, int yTop) {
graphics.centeredText(this.font, this.title, xCenter, yTop, -1);
}
private void extractProgress(GuiGraphicsExtractor graphics, int xCenter, int textTop) {
UpgradeProgress.FileFixStats typeFileStats = this.upgradeProgress.getTypeFileFixStats();
UpgradeProgress.FileFixStats totalFileStats = this.upgradeProgress.getTotalFileFixStats();
UpgradeProgress.FileFixStats runningFileFixerStats = this.upgradeProgress.getRunningFileFixerStats();
int y = textTop + 9 + 3;
this.extractProgressBar(graphics, xCenter, y, runningFileFixerStats.getProgress());
y += 7;
this.extractFileStats(graphics, xCenter, y, totalFileStats.finishedOperations(), totalFileStats.totalOperations());
y += 9 * 2 + 6;
this.extractFileFixerCount(graphics, xCenter, y, runningFileFixerStats.finishedOperations(), runningFileFixerStats.totalOperations());
y += 9 + 30 - 5;
this.extractTypeText(graphics, xCenter, y);
y += 9 + 3;
this.extractProgressBar(graphics, xCenter, y, typeFileStats.getProgress());
y += 7;
this.extractTypeProgress(graphics, xCenter, y, typeFileStats.getProgress());
}
private void extractProgressBar(GuiGraphicsExtractor graphics, int xCenter, int y, float progress) {
int barLeft = xCenter - 100;
int barRight = barLeft + 200;
int barBottom = y + 2;
graphics.fill(barLeft, y, barRight, barBottom, -16777216);
graphics.fill(barLeft, y, barLeft + Math.round(progress * 200.0F), barBottom, -16711936);
}
private void extractTypeText(GuiGraphicsExtractor graphics, int xCenter, int y) {
UpgradeProgress.Type upgradeProgressType = this.upgradeProgress.getType();
if (upgradeProgressType != null) {
graphics.centeredText(this.font, upgradeProgressType.label(), xCenter, y, -6250336);
}
}
private void extractTypeProgress(GuiGraphicsExtractor graphics, int xCenter, int y, float progress) {
Component percentageText = Component.translatable("upgradeWorld.progress.percentage", Mth.floor(progress * 100.0F));
graphics.centeredText(this.font, percentageText, xCenter, y, -6250336);
}
private void extractFileStats(GuiGraphicsExtractor graphics, int xCenter, int yStart, int converted, int total) {
int lineHeight = 9 + 3;
graphics.centeredText(this.font, Component.translatable("upgradeWorld.info.converted", converted), xCenter, yStart, -6250336);
graphics.centeredText(this.font, Component.translatable("upgradeWorld.info.total", total), xCenter, yStart + lineHeight, -6250336);
}
private void extractScanning(GuiGraphicsExtractor graphics, int xCenter, int textTop) {
graphics.centeredText(this.font, SCANNING, xCenter, textTop + 9 + 3, -6250336);
}
private void extractFileFixerCount(GuiGraphicsExtractor graphics, int xCenter, int y, int current, int total) {
Component percentageText = Component.translatable("upgradeWorld.info.file_fix_stage", current, total);
graphics.centeredText(this.font, percentageText, xCenter, y, -6250336);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
Button.builder()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
Component.translatable()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.floor()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: