RealmsClientOutdatedScreen .java

com.mojang.realmsclient.gui.screens.RealmsClientOutdatedScreen (class, 51 lines): members: UNSUPPORTED_SNAPSHOT_VERSION, INCOMPATIBLE_CLIENT_VERSION, init.

com.mojang.realmsclient.gui.screensclass51 linescommonextends RealmsScreen2.1 KB

API Surface (3)

void init()
void repositionElements()
void onClose()

Fields & Constants (6)

INCOMPATIBLE_TITLE
INCOMPATIBLE_CLIENT_VERSION
UNSUPPORTED_SNAPSHOT_VERSION
OUTDATED_STABLE_VERSION
lastScreen
layout

String literals (3)

"mco.client.incompatible.title"
"mco.client.unsupported.snapshot.version"
"mco.client.outdated.stable.version"

Full Source

RealmsClientOutdatedScreen.java51 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.gui.screens;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.SharedConstants;
6
import net.minecraft.client.gui.components.Button;
7
import net.minecraft.client.gui.components.MultiLineTextWidget;
8
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
9
import net.minecraft.client.gui.screens.Screen;
10
import net.minecraft.network.chat.CommonComponents;
11
import net.minecraft.network.chat.Component;
12
import net.minecraft.realms.RealmsScreen;
13
14
@Environment(EnvType.CLIENT)
15
public class RealmsClientOutdatedScreen extends RealmsScreen {
16
	private static final Component INCOMPATIBLE_TITLE = Component.translatable("mco.client.incompatible.title").withColor(-65536);
17
	private static final Component INCOMPATIBLE_CLIENT_VERSION = Component.literal(SharedConstants.getCurrentVersion().name()).withColor(-65536);
18
	private static final Component UNSUPPORTED_SNAPSHOT_VERSION = Component.translatable("mco.client.unsupported.snapshot.version", INCOMPATIBLE_CLIENT_VERSION);
19
	private static final Component OUTDATED_STABLE_VERSION = Component.translatable("mco.client.outdated.stable.version", INCOMPATIBLE_CLIENT_VERSION);
20
	private final Screen lastScreen;
21
	private final HeaderAndFooterLayout layout = new HeaderAndFooterLayout(this);
22
23
	public RealmsClientOutdatedScreen(final Screen lastScreen) {
24
		super(INCOMPATIBLE_TITLE);
25
		this.lastScreen = lastScreen;
26
	}
27
28
	@Override
29
	public void init() {
30
		this.layout.addTitleHeader(INCOMPATIBLE_TITLE, this.font);
31
		this.layout.addToContents(new MultiLineTextWidget(this.getErrorMessage(), this.font).setCentered(true));
32
		this.layout.addToFooter(Button.builder(CommonComponents.GUI_BACK, button -> this.onClose()).width(200).build());
33
		this.layout.visitWidgets(x$0 -> this.addRenderableWidget(x$0));
34
		this.repositionElements();
35
	}
36
37
	@Override
38
	protected void repositionElements() {
39
		this.layout.arrangeElements();
40
	}
41
42
	@Override
43
	public void onClose() {
44
		this.minecraft.gui.setScreen(this.lastScreen);
45
	}
46
47
	private Component getErrorMessage() {
48
		return SharedConstants.getCurrentVersion().stable() ? OUTDATED_STABLE_VERSION : UNSUPPORTED_SNAPSHOT_VERSION;
49
	}
50
}
51

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