RealmCreationTask .java

com.mojang.realmsclient.util.task.RealmCreationTask (class, 45 lines): members: motd, realmId, getTitle, TITLE, run, name, LOGGER. imports: RealmsClient.

com.mojang.realmsclient.util.taskclass45 linescommonextends LongRunningTask1.2 KB

API Surface (2)

void run()
Component getTitle()

Fields & Constants (5)

LOGGER
TITLE
name
motd
realmId

String literals (3)

"mco.create.world.wait"
"Couldn't create world"
"Could not create world"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

RealmCreationTask.java45 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.util.task;
2
3
import com.mojang.logging.LogUtils;
4
import com.mojang.realmsclient.client.RealmsClient;
5
import com.mojang.realmsclient.exception.RealmsServiceException;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
import net.minecraft.network.chat.Component;
9
import org.slf4j.Logger;
10
11
@Environment(EnvType.CLIENT)
12
public class RealmCreationTask extends LongRunningTask {
13
	private static final Logger LOGGER = LogUtils.getLogger();
14
	private static final Component TITLE = Component.translatable("mco.create.world.wait");
15
	private final String name;
16
	private final String motd;
17
	private final long realmId;
18
19
	public RealmCreationTask(final long realmId, final String name, final String motd) {
20
		this.realmId = realmId;
21
		this.name = name;
22
		this.motd = motd;
23
	}
24
25
	@Override
26
	public void run() {
27
		RealmsClient client = RealmsClient.getOrCreate();
28
29
		try {
30
			client.initializeRealm(this.realmId, this.name, this.motd);
31
		} catch (RealmsServiceException e) {
32
			LOGGER.error("Couldn't create world", e);
33
			this.error(e);
34
		} catch (Exception e) {
35
			LOGGER.error("Could not create world", e);
36
			this.error(e);
37
		}
38
	}
39
40
	@Override
41
	public Component getTitle() {
42
		return TITLE;
43
	}
44
}
45

Decompiled Minecraft 26.3 source of RealmCreationTask (com/mojang/realmsclient/util/task/RealmCreationTask.java) with Mojang official mappings, stored verbatim on the site.