BakedQuad.java

net.minecraft.client.resources.model.geometry.BakedQuad

信息

  • 全限定名:net.minecraft.client.resources.model.geometry.BakedQuad
  • 类型:public record
  • 包:net.minecraft.client.resources.model.geometry
  • 源码路径:src/main/java/net/minecraft/client/resources/model/geometry/BakedQuad.java
  • 起始行号:L20
  • 职责:

    TODO

字段/常量

  • VERTEX_COUNT

    • 类型: int
    • 修饰符: public static final
    • 源码定位: L32
    • 说明:

      TODO

  • FLAG_TRANSLUCENT

    • 类型: int
    • 修饰符: public static final
    • 源码定位: L33
    • 说明:

      TODO

  • FLAG_ANIMATED

    • 类型: int
    • 修饰符: public static final
    • 源码定位: L34
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.client.resources.model.geometry.BakedQuad.MaterialFlags

    • 类型: annotation
    • 修饰符: public
    • 源码定位: L59
    • 说明:

      TODO

  • net.minecraft.client.resources.model.geometry.BakedQuad.MaterialInfo

    • 类型: record
    • 修饰符: public
    • 源码定位: L63
    • 说明:

      TODO

构造器

方法

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

public Vector3fc position(int vertex) @ L36

  • 方法名:position
  • 源码定位:L36
  • 返回类型:Vector3fc
  • 修饰符:public

参数:

  • vertex: int

说明:

TODO

public long packedUV(int vertex) @ L46

  • 方法名:packedUV
  • 源码定位:L46
  • 返回类型:long
  • 修饰符:public

参数:

  • vertex: int

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public record BakedQuad(
    Vector3fc position0,
    Vector3fc position1,
    Vector3fc position2,
    Vector3fc position3,
    long packedUV0,
    long packedUV1,
    long packedUV2,
    long packedUV3,
    Direction direction,
    BakedQuad.MaterialInfo materialInfo
) {
    public static final int VERTEX_COUNT = 4;
    public static final int FLAG_TRANSLUCENT = 1;
    public static final int FLAG_ANIMATED = 2;
 
    public Vector3fc position(int vertex) {
        return switch (vertex) {
            case 0 -> this.position0;
            case 1 -> this.position1;
            case 2 -> this.position2;
            case 3 -> this.position3;
            default -> throw new IndexOutOfBoundsException(vertex);
        };
    }
 
    public long packedUV(int vertex) {
        return switch (vertex) {
            case 0 -> this.packedUV0;
            case 1 -> this.packedUV1;
            case 2 -> this.packedUV2;
            case 3 -> this.packedUV3;
            default -> throw new IndexOutOfBoundsException(vertex);
        };
    }
 
    @Retention(RetentionPolicy.CLASS)
    @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE})
    @OnlyIn(Dist.CLIENT)
    public @interface MaterialFlags {
    }
 
    @OnlyIn(Dist.CLIENT)
    public record MaterialInfo(TextureAtlasSprite sprite, ChunkSectionLayer layer, RenderType itemRenderType, int tintIndex, boolean shade, int lightEmission) {
        public static BakedQuad.MaterialInfo of(Material.Baked material, Transparency transparency, int tintIndex, boolean shade, int lightEmission) {
            ChunkSectionLayer layer = ChunkSectionLayer.byTransparency(transparency);
            RenderType itemRenderType;
            if (material.sprite().atlasLocation().equals(TextureAtlas.LOCATION_BLOCKS)) {
                itemRenderType = transparency.hasTranslucent() ? Sheets.translucentBlockItemSheet() : Sheets.cutoutBlockItemSheet();
            } else {
                itemRenderType = transparency.hasTranslucent() ? Sheets.translucentItemSheet() : Sheets.cutoutItemSheet();
            }
 
            return new BakedQuad.MaterialInfo(material.sprite(), layer, itemRenderType, tintIndex, shade, lightEmission);
        }
 
        public boolean isTinted() {
            return this.tintIndex != -1;
        }
 
        @BakedQuad.MaterialFlags
        public int flags() {
            int flags = 0;
            flags |= this.layer.translucent() ? 1 : 0;
            return flags | (this.sprite.contents().isAnimated() ? 2 : 0);
        }
    }
}

引用的其他类

  • Sheets

    • 引用位置: 方法调用
    • 关联成员: Sheets.cutoutBlockItemSheet(), Sheets.cutoutItemSheet(), Sheets.translucentBlockItemSheet(), Sheets.translucentItemSheet()
  • ChunkSectionLayer

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