WorldDownload .java

com.mojang.realmsclient.dto.WorldDownload (record, 30 lines): members: downloadLink, resourcePackUrl, resourcePackHash, parse, LOGGER. imports: JsonUtils.

com.mojang.realmsclient.dtorecord30 linescommon974 B

API Surface (2)

record WorldDownload(String downloadLink, String resourcePackUrl, String resourcePackHash)
WorldDownload parse(final String json)

Fields & Constants (1)

LOGGER

String literals (4)

"downloadLink"
"resourcePackUrl"
"resourcePackHash"
"Could not parse WorldDownload"

Code Graph: Dependencies (2)

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

Full Source

WorldDownload.java30 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.dto;
2
3
import com.google.gson.JsonObject;
4
import com.mojang.logging.LogUtils;
5
import com.mojang.realmsclient.util.JsonUtils;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
import net.minecraft.util.LenientJsonParser;
9
import org.slf4j.Logger;
10
11
@Environment(EnvType.CLIENT)
12
public record WorldDownload(String downloadLink, String resourcePackUrl, String resourcePackHash) {
13
	private static final Logger LOGGER = LogUtils.getLogger();
14
15
	public static WorldDownload parse(final String json) {
16
		JsonObject jsonObject = LenientJsonParser.parse(json).getAsJsonObject();
17
18
		try {
19
			return new WorldDownload(
20
				JsonUtils.getStringOr("downloadLink", jsonObject, ""),
21
				JsonUtils.getStringOr("resourcePackUrl", jsonObject, ""),
22
				JsonUtils.getStringOr("resourcePackHash", jsonObject, "")
23
			);
24
		} catch (Exception e) {
25
			LOGGER.error("Could not parse WorldDownload", e);
26
			return new WorldDownload("", "", "");
27
		}
28
	}
29
}
30

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