AbstractRealmsCodeScreen .java

com.mojang.realmsclient.gui.screens.AbstractRealmsCodeScreen (class): members: shouldRenderListBackgroundAndSeparators, MENU_LIST_BACKGROUND, layout.

com.mojang.realmsclient.gui.screensclass50 linescommonextends RealmsScreen1.9 KB

API Surface (4)

void repositionElements()
void extractMenuBackground(final GuiGraphicsExtractor graphics)
void extractRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a)
boolean shouldRenderListBackgroundAndSeparators()

Fields & Constants (2)

MENU_LIST_BACKGROUND
layout

String literals (1)

"textures/gui/menu_list_background.png"

Full Source

AbstractRealmsCodeScreen.java50 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.client.gui.GuiGraphicsExtractor;
6
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
7
import net.minecraft.client.gui.screens.Screen;
8
import net.minecraft.client.renderer.RenderPipelines;
9
import net.minecraft.network.chat.Component;
10
import net.minecraft.realms.RealmsScreen;
11
import net.minecraft.resources.Identifier;
12
13
@Environment(EnvType.CLIENT)
14
public abstract class AbstractRealmsCodeScreen extends RealmsScreen {
15
	private static final Identifier MENU_LIST_BACKGROUND = Identifier.withDefaultNamespace("textures/gui/menu_list_background.png");
16
	protected final HeaderAndFooterLayout layout = new HeaderAndFooterLayout(this);
17
18
	protected AbstractRealmsCodeScreen(final Component title) {
19
		super(title);
20
	}
21
22
	@Override
23
	protected void repositionElements() {
24
		this.layout.arrangeElements();
25
	}
26
27
	@Override
28
	protected void extractMenuBackground(final GuiGraphicsExtractor graphics) {
29
		super.extractMenuBackground(graphics, 0, 0, this.width, this.height);
30
		if (this.shouldRenderListBackgroundAndSeparators()) {
31
			graphics.blit(
32
				RenderPipelines.GUI_TEXTURED, MENU_LIST_BACKGROUND, 0, this.layout.getHeaderHeight(), 0.0F, 0.0F, this.width, this.layout.getContentHeight(), 32, 32
33
			);
34
		}
35
	}
36
37
	@Override
38
	public void extractRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
39
		super.extractRenderState(graphics, mouseX, mouseY, a);
40
		if (this.shouldRenderListBackgroundAndSeparators()) {
41
			graphics.blit(RenderPipelines.GUI_TEXTURED, Screen.HEADER_SEPARATOR, 0, this.layout.getHeaderHeight() - 2, 0.0F, 0.0F, this.width, 2, 32, 2);
42
			graphics.blit(RenderPipelines.GUI_TEXTURED, Screen.FOOTER_SEPARATOR, 0, this.height - this.layout.getFooterHeight(), 0.0F, 0.0F, this.width, 2, 32, 2);
43
		}
44
	}
45
46
	protected boolean shouldRenderListBackgroundAndSeparators() {
47
		return true;
48
	}
49
}
50

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