DownloadTask.java
com.mojang.realmsclient.util.task.DownloadTask
信息
- 全限定名:com.mojang.realmsclient.util.task.DownloadTask
- 类型:public class
- 包:com.mojang.realmsclient.util.task
- 源码路径:src/main/java/com/mojang/realmsclient/util/task/DownloadTask.java
- 起始行号:L17
- 继承:LongRunningTask
- 职责:
TODO
字段/常量
-
LOGGER- 类型:
Logger - 修饰符:
private static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
TITLE- 类型:
Component - 修饰符:
private static final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
realmId- 类型:
long - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
slot- 类型:
int - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
lastScreen- 类型:
Screen - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
downloadName- 类型:
String - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public DownloadTask(long realmId, int slot, String downloadName, Screen lastScreen) @ L25
- 构造器名:DownloadTask
- 源码定位:L25
- 修饰符:public
参数:
- realmId: long
- slot: int
- downloadName: String
- lastScreen: Screen
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void run() @ L32
- 方法名:run
- 源码定位:L32
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public Component getTitle() @ L78
- 方法名:getTitle
- 源码定位:L78
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class DownloadTask extends LongRunningTask {
private static final Logger LOGGER = LogUtils.getLogger();
private static final Component TITLE = Component.translatable("mco.download.preparing");
private final long realmId;
private final int slot;
private final Screen lastScreen;
private final String downloadName;
public DownloadTask(long realmId, int slot, String downloadName, Screen lastScreen) {
this.realmId = realmId;
this.slot = slot;
this.lastScreen = lastScreen;
this.downloadName = downloadName;
}
@Override
public void run() {
RealmsClient client = RealmsClient.getOrCreate();
int i = 0;
while (i < 25) {
try {
if (this.aborted()) {
return;
}
WorldDownload worldDownload = client.requestDownloadInfo(this.realmId, this.slot);
pause(1L);
if (this.aborted()) {
return;
}
setScreen(new RealmsDownloadLatestWorldScreen(this.lastScreen, worldDownload, this.downloadName, result -> {}));
return;
} catch (RetryCallException var4) {
if (this.aborted()) {
return;
}
pause(var4.delaySeconds);
i++;
} catch (RealmsServiceException var5) {
if (this.aborted()) {
return;
}
LOGGER.error("Couldn't download world data", (Throwable)var5);
setScreen(new RealmsGenericErrorScreen(var5, this.lastScreen));
return;
} catch (Exception var6) {
if (this.aborted()) {
return;
}
LOGGER.error("Couldn't download world data", (Throwable)var6);
this.error(var6);
return;
}
}
}
@Override
public Component getTitle() {
return TITLE;
}
}引用的其他类
-
- 引用位置:
方法调用 - 关联成员:
RealmsClient.getOrCreate()
- 引用位置:
-
RealmsDownloadLatestWorldScreen
- 引用位置:
构造调用 - 关联成员:
RealmsDownloadLatestWorldScreen()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
RealmsGenericErrorScreen()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段/方法调用/返回值 - 关联成员:
Component.translatable()
- 引用位置: