TextureSetup .java

net.minecraft.client.gui.render.TextureSetup (record, 51 lines): members: texure0, texure1, texure2, sampler0, sampler1, sampler2, NO_TEXTURE_SETUP.

net.minecraft.client.gui.renderrecord51 linesclient1.8 KB

API Surface (7)

record TextureSetup(@Nullable GpuTextureView texure0, @Nullable GpuTextureView texure1, @Nullable GpuTextureView texure2, @Nullable GpuSampler sampler0, @Nullable GpuSampler sampler1, @Nullable GpuSampler sampler2)
TextureSetup singleTexture(final GpuTextureView texture, final GpuSampler sampler)
TextureSetup singleTextureWithLightmap(final GpuTextureView texture, final GpuSampler sampler)
TextureSetup doubleTexture(final GpuTextureView texture0, final GpuSampler sampler0, final GpuTextureView texture1, final GpuSampler sampler1)
TextureSetup noTexture()
int getSortKey()
void updateSortKeySeed()

Fields & Constants (2)

NO_TEXTURE_SETUP
sortKeySeed

Code Graph: Dependencies (6)

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

Full Source

TextureSetup.java51 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.render;
2
3
import com.mojang.blaze3d.systems.RenderSystem;
4
import com.mojang.renderpearl.api.textures.FilterMode;
5
import com.mojang.renderpearl.api.textures.GpuSampler;
6
import com.mojang.renderpearl.api.textures.GpuTextureView;
7
import net.fabricmc.api.EnvType;
8
import net.fabricmc.api.Environment;
9
import net.minecraft.SharedConstants;
10
import net.minecraft.client.Minecraft;
11
import org.jspecify.annotations.Nullable;
12
13
@Environment(EnvType.CLIENT)
14
public record TextureSetup(
15
	@Nullable GpuTextureView texure0,
16
	@Nullable GpuTextureView texure1,
17
	@Nullable GpuTextureView texure2,
18
	@Nullable GpuSampler sampler0,
19
	@Nullable GpuSampler sampler1,
20
	@Nullable GpuSampler sampler2
21
) {
22
	private static final TextureSetup NO_TEXTURE_SETUP = new TextureSetup(null, null, null, null, null, null);
23
	private static int sortKeySeed;
24
25
	public static TextureSetup singleTexture(final GpuTextureView texture, final GpuSampler sampler) {
26
		return new TextureSetup(texture, null, null, sampler, null, null);
27
	}
28
29
	public static TextureSetup singleTextureWithLightmap(final GpuTextureView texture, final GpuSampler sampler) {
30
		return new TextureSetup(
31
			texture, null, Minecraft.getInstance().gameRenderer.lightmap(), sampler, null, RenderSystem.getSamplerCache().getClampToEdge(FilterMode.LINEAR)
32
		);
33
	}
34
35
	public static TextureSetup doubleTexture(final GpuTextureView texture0, final GpuSampler sampler0, final GpuTextureView texture1, final GpuSampler sampler1) {
36
		return new TextureSetup(texture0, texture1, null, sampler0, sampler1, null);
37
	}
38
39
	public static TextureSetup noTexture() {
40
		return NO_TEXTURE_SETUP;
41
	}
42
43
	public int getSortKey() {
44
		return SharedConstants.DEBUG_SHUFFLE_UI_RENDERING_ORDER ? this.hashCode() * (sortKeySeed + 1) : this.hashCode();
45
	}
46
47
	public static void updateSortKeySeed() {
48
		sortKeySeed = Math.round(100000.0F * (float)Math.random());
49
	}
50
}
51

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