Model.java

net.minecraft.client.model.Model

信息

  • 全限定名:net.minecraft.client.model.Model
  • 类型:public abstract class
  • 包:net.minecraft.client.model
  • 源码路径:src/main/java/net/minecraft/client/model/Model.java
  • 起始行号:L15
  • 职责:

    TODO

字段/常量

  • root

    • 类型: ModelPart
    • 修饰符: protected final
    • 源码定位: L16
    • 说明:

      TODO

  • renderType

    • 类型: Function<Identifier,RenderType>
    • 修饰符: protected final
    • 源码定位: L17
    • 说明:

      TODO

  • allParts

    • 类型: List<ModelPart>
    • 修饰符: private final
    • 源码定位: L18
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.client.model.Model.Simple
    • 类型: class
    • 修饰符: public static
    • 源码定位: L61
    • 说明:

      TODO

构造器

public Model(ModelPart root, Function<Identifier,RenderType> renderType) @ L20

  • 构造器名:Model
  • 源码定位:L20
  • 修饰符:public

参数:

  • root: ModelPart
  • renderType: Function<Identifier,RenderType>

说明:

TODO

方法

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

public final Function<Identifier,RenderType> renderType() @ L26

  • 方法名:renderType
  • 源码定位:L26
  • 返回类型:Function<Identifier,RenderType>
  • 修饰符:public final

参数:

说明:

TODO

public final RenderType renderType(Identifier texture) @ L30

  • 方法名:renderType
  • 源码定位:L30
  • 返回类型:RenderType
  • 修饰符:public final

参数:

  • texture: Identifier

说明:

TODO

public final void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int lightCoords, int overlayCoords, int color) @ L34

  • 方法名:renderToBuffer
  • 源码定位:L34
  • 返回类型:void
  • 修饰符:public final

参数:

  • poseStack: PoseStack
  • buffer: VertexConsumer
  • lightCoords: int
  • overlayCoords: int
  • color: int

说明:

TODO

public final void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int lightCoords, int overlayCoords) @ L38

  • 方法名:renderToBuffer
  • 源码定位:L38
  • 返回类型:void
  • 修饰符:public final

参数:

  • poseStack: PoseStack
  • buffer: VertexConsumer
  • lightCoords: int
  • overlayCoords: int

说明:

TODO

public final ModelPart root() @ L42

  • 方法名:root
  • 源码定位:L42
  • 返回类型:ModelPart
  • 修饰符:public final

参数:

说明:

TODO

public final List<ModelPart> allParts() @ L46

  • 方法名:allParts
  • 源码定位:L46
  • 返回类型:List
  • 修饰符:public final

参数:

说明:

TODO

public void setupAnim(S state) @ L50

  • 方法名:setupAnim
  • 源码定位:L50
  • 返回类型:void
  • 修饰符:public

参数:

  • state: S

说明:

TODO

public final void resetPose() @ L54

  • 方法名:resetPose
  • 源码定位:L54
  • 返回类型:void
  • 修饰符:public final

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class Model<S> {
    protected final ModelPart root;
    protected final Function<Identifier, RenderType> renderType;
    private final List<ModelPart> allParts;
 
    public Model(ModelPart root, Function<Identifier, RenderType> renderType) {
        this.root = root;
        this.renderType = renderType;
        this.allParts = root.getAllParts();
    }
 
    public final Function<Identifier, RenderType> renderType() {
        return this.renderType;
    }
 
    public final RenderType renderType(Identifier texture) {
        return this.renderType().apply(texture);
    }
 
    public final void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int lightCoords, int overlayCoords, int color) {
        this.root().render(poseStack, buffer, lightCoords, overlayCoords, color);
    }
 
    public final void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int lightCoords, int overlayCoords) {
        this.renderToBuffer(poseStack, buffer, lightCoords, overlayCoords, -1);
    }
 
    public final ModelPart root() {
        return this.root;
    }
 
    public final List<ModelPart> allParts() {
        return this.allParts;
    }
 
    public void setupAnim(S state) {
        this.resetPose();
    }
 
    public final void resetPose() {
        for (ModelPart part : this.allParts) {
            part.resetPose();
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class Simple extends Model<Unit> {
        public Simple(ModelPart root, Function<Identifier, RenderType> renderType) {
            super(root, renderType);
        }
 
        public void setupAnim(Unit state) {
        }
    }
}

引用的其他类