RealmsJoinInformation .java

com.mojang.realmsclient.dto.RealmsJoinInformation (record): members: address, resourcePackUrl, resourcePackHash, regionData, RegionData, parse, EMPTY.

com.mojang.realmsclient.dtorecord41 linescommon1.5 KB

Implements

API Surface (1)

RealmsJoinInformation parse(final GuardedSerializer gson, final String json)

Fields & Constants (2)

LOGGER
EMPTY

String literals (7)

"address"
"resourcePackUrl"
"resourcePackHash"
"sessionRegionData"
"Could not parse RealmsServerAddress"
"regionName"
"serviceQuality"

Code Graph: Dependencies (4)

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

Full Source

RealmsJoinInformation.java41 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.dto;
2
3
import com.google.gson.annotations.SerializedName;
4
import com.mojang.logging.LogUtils;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import org.jspecify.annotations.Nullable;
8
import org.slf4j.Logger;
9
10
@Environment(EnvType.CLIENT)
11
public record RealmsJoinInformation(
12
	@SerializedName("address") @Nullable String address,
13
	@SerializedName("resourcePackUrl") @Nullable String resourcePackUrl,
14
	@SerializedName("resourcePackHash") @Nullable String resourcePackHash,
15
	@SerializedName("sessionRegionData") RealmsJoinInformation.@Nullable RegionData regionData
16
) implements ReflectionBasedSerialization {
17
	private static final Logger LOGGER = LogUtils.getLogger();
18
	private static final RealmsJoinInformation EMPTY = new RealmsJoinInformation(null, null, null, null);
19
20
	public static RealmsJoinInformation parse(final GuardedSerializer gson, final String json) {
21
		try {
22
			RealmsJoinInformation server = gson.fromJson(json, RealmsJoinInformation.class);
23
			if (server == null) {
24
				LOGGER.error("Could not parse RealmsServerAddress: {}", json);
25
				return EMPTY;
26
			} else {
27
				return server;
28
			}
29
		} catch (Exception e) {
30
			LOGGER.error("Could not parse RealmsServerAddress", e);
31
			return EMPTY;
32
		}
33
	}
34
35
	@Environment(EnvType.CLIENT)
36
	public record RegionData(
37
		@SerializedName("regionName") @Nullable RealmsRegion region, @SerializedName("serviceQuality") @Nullable ServiceQuality serviceQuality
38
	) implements ReflectionBasedSerialization {
39
	}
40
}
41

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