RealmsConfirmScreen .java

com.mojang.realmsclient.gui.screens.RealmsConfirmScreen (class, 39 lines): members: title1, title2, callback, init, extractRenderState. imports: Button.

com.mojang.realmsclient.gui.screensclass39 linescommonextends RealmsScreen1.5 KB

API Surface (2)

void init()
void extractRenderState(final GuiGraphicsExtractor graphics, final int xm, final int ym, final float a)

Fields & Constants (3)

callback
title1
title2

Code Graph: Dependencies (6)

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

Full Source

RealmsConfirmScreen.java39 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.gui.screens;
2
3
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.GameNarrator;
7
import net.minecraft.client.gui.GuiGraphicsExtractor;
8
import net.minecraft.client.gui.components.Button;
9
import net.minecraft.network.chat.CommonComponents;
10
import net.minecraft.network.chat.Component;
11
import net.minecraft.realms.RealmsScreen;
12
13
@Environment(EnvType.CLIENT)
14
public class RealmsConfirmScreen extends RealmsScreen {
15
	protected final BooleanConsumer callback;
16
	private final Component title1;
17
	private final Component title2;
18
19
	public RealmsConfirmScreen(final BooleanConsumer callback, final Component title1, final Component title2) {
20
		super(GameNarrator.NO_TITLE);
21
		this.callback = callback;
22
		this.title1 = title1;
23
		this.title2 = title2;
24
	}
25
26
	@Override
27
	public void init() {
28
		this.addRenderableWidget(Button.builder(CommonComponents.GUI_YES, button -> this.callback.accept(true)).bounds(this.width / 2 - 105, row(9), 100, 20).build());
29
		this.addRenderableWidget(Button.builder(CommonComponents.GUI_NO, button -> this.callback.accept(false)).bounds(this.width / 2 + 5, row(9), 100, 20).build());
30
	}
31
32
	@Override
33
	public void extractRenderState(final GuiGraphicsExtractor graphics, final int xm, final int ym, final float a) {
34
		super.extractRenderState(graphics, xm, ym, a);
35
		graphics.centeredText(this.font, this.title1, this.width / 2, row(3), -1);
36
		graphics.centeredText(this.font, this.title2, this.width / 2, row(5), -1);
37
	}
38
}
39

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