TextureSetup.java

net.minecraft.client.gui.render.TextureSetup

信息

  • 全限定名:net.minecraft.client.gui.render.TextureSetup
  • 类型:public record
  • 包:net.minecraft.client.gui.render
  • 源码路径:src/main/java/net/minecraft/client/gui/render/TextureSetup.java
  • 起始行号:L14
  • 职责:

    TODO

字段/常量

  • NO_TEXTURE_SETUP

    • 类型: TextureSetup
    • 修饰符: private static final
    • 源码定位: L22
    • 说明:

      TODO

  • sortKeySeed

    • 类型: int
    • 修饰符: private static
    • 源码定位: L23
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public static TextureSetup singleTexture(GpuTextureView texture, GpuSampler sampler) @ L25

  • 方法名:singleTexture
  • 源码定位:L25
  • 返回类型:TextureSetup
  • 修饰符:public static

参数:

  • texture: GpuTextureView
  • sampler: GpuSampler

说明:

TODO

public static TextureSetup singleTextureWithLightmap(GpuTextureView texture, GpuSampler sampler) @ L29

  • 方法名:singleTextureWithLightmap
  • 源码定位:L29
  • 返回类型:TextureSetup
  • 修饰符:public static

参数:

  • texture: GpuTextureView
  • sampler: GpuSampler

说明:

TODO

public static TextureSetup doubleTexture(GpuTextureView texture0, GpuSampler sampler0, GpuTextureView texture1, GpuSampler sampler1) @ L35

  • 方法名:doubleTexture
  • 源码定位:L35
  • 返回类型:TextureSetup
  • 修饰符:public static

参数:

  • texture0: GpuTextureView
  • sampler0: GpuSampler
  • texture1: GpuTextureView
  • sampler1: GpuSampler

说明:

TODO

public static TextureSetup noTexture() @ L39

  • 方法名:noTexture
  • 源码定位:L39
  • 返回类型:TextureSetup
  • 修饰符:public static

参数:

说明:

TODO

public int getSortKey() @ L43

  • 方法名:getSortKey
  • 源码定位:L43
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public static void updateSortKeySeed() @ L47

  • 方法名:updateSortKeySeed
  • 源码定位:L47
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public record TextureSetup(
    @Nullable GpuTextureView texure0,
    @Nullable GpuTextureView texure1,
    @Nullable GpuTextureView texure2,
    @Nullable GpuSampler sampler0,
    @Nullable GpuSampler sampler1,
    @Nullable GpuSampler sampler2
) {
    private static final TextureSetup NO_TEXTURE_SETUP = new TextureSetup(null, null, null, null, null, null);
    private static int sortKeySeed;
 
    public static TextureSetup singleTexture(GpuTextureView texture, GpuSampler sampler) {
        return new TextureSetup(texture, null, null, sampler, null, null);
    }
 
    public static TextureSetup singleTextureWithLightmap(GpuTextureView texture, GpuSampler sampler) {
        return new TextureSetup(
            texture, null, Minecraft.getInstance().gameRenderer.lightmap(), sampler, null, RenderSystem.getSamplerCache().getClampToEdge(FilterMode.LINEAR)
        );
    }
 
    public static TextureSetup doubleTexture(GpuTextureView texture0, GpuSampler sampler0, GpuTextureView texture1, GpuSampler sampler1) {
        return new TextureSetup(texture0, texture1, null, sampler0, sampler1, null);
    }
 
    public static TextureSetup noTexture() {
        return NO_TEXTURE_SETUP;
    }
 
    public int getSortKey() {
        return SharedConstants.DEBUG_SHUFFLE_UI_RENDERING_ORDER ? this.hashCode() * (sortKeySeed + 1) : this.hashCode();
    }
 
    public static void updateSortKeySeed() {
        sortKeySeed = Math.round(100000.0F * (float)Math.random());
    }
}

引用的其他类

  • RenderSystem

    • 引用位置: 方法调用
    • 关联成员: RenderSystem.getSamplerCache()
  • GpuSampler

    • 引用位置: 参数
  • GpuTextureView

    • 引用位置: 参数
  • Minecraft

    • 引用位置: 方法调用
    • 关联成员: Minecraft.getInstance()