ContainerScreen .java

net.minecraft.client.gui.screens.inventory.ContainerScreen (class): members: CONTAINER_BACKGROUND, containerRows, extractBackground. imports: ChestMenu.

net.minecraft.client.gui.screens.inventoryclass32 linesclientextends AbstractContainerScreen<ChestMenu>1.5 KB

API Surface (1)

void extractBackground(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a)

Fields & Constants (2)

CONTAINER_BACKGROUND
containerRows

String literals (1)

"textures/gui/container/generic_54.png"

Full Source

ContainerScreen.java32 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.screens.inventory;
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.renderer.RenderPipelines;
7
import net.minecraft.network.chat.Component;
8
import net.minecraft.resources.Identifier;
9
import net.minecraft.world.entity.player.Inventory;
10
import net.minecraft.world.inventory.ChestMenu;
11
12
@Environment(EnvType.CLIENT)
13
public class ContainerScreen extends AbstractContainerScreen<ChestMenu> {
14
	private static final Identifier CONTAINER_BACKGROUND = Identifier.withDefaultNamespace("textures/gui/container/generic_54.png");
15
	private final int containerRows;
16
17
	public ContainerScreen(final ChestMenu menu, final Inventory inventory, final Component title) {
18
		super(menu, inventory, title, 176, 114 + menu.getRowCount() * 18);
19
		this.containerRows = menu.getRowCount();
20
		this.inventoryLabelY = this.imageHeight - 94;
21
	}
22
23
	@Override
24
	public void extractBackground(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
25
		super.extractBackground(graphics, mouseX, mouseY, a);
26
		int xo = (this.width - this.imageWidth) / 2;
27
		int yo = (this.height - this.imageHeight) / 2;
28
		graphics.blit(RenderPipelines.GUI_TEXTURED, CONTAINER_BACKGROUND, xo, yo, 0.0F, 0.0F, this.imageWidth, this.containerRows * 18 + 17, 256, 256);
29
		graphics.blit(RenderPipelines.GUI_TEXTURED, CONTAINER_BACKGROUND, xo, yo + this.containerRows * 18 + 17, 0.0F, 126.0F, this.imageWidth, 96, 256, 256);
30
	}
31
}
32

Decompiled Minecraft 26.3 source of ContainerScreen (net/minecraft/client/gui/screens/inventory/ContainerScreen.java) with Mojang official mappings, stored verbatim on the site.