SkullModel.java

net.minecraft.client.model.object.skull.SkullModel

信息

  • 全限定名:net.minecraft.client.model.object.skull.SkullModel
  • 类型:public class
  • 包:net.minecraft.client.model.object.skull
  • 源码路径:src/main/java/net/minecraft/client/model/object/skull/SkullModel.java
  • 起始行号:L14
  • 继承:SkullModelBase
  • 职责:

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

构造器

public SkullModel(ModelPart root) @ L17

  • 构造器名:SkullModel
  • 源码定位:L17
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static MeshDefinition createHeadModel() @ L22

  • 方法名:createHeadModel
  • 源码定位:L22
  • 返回类型:MeshDefinition
  • 修饰符:public static

参数:

说明:

TODO

public static LayerDefinition createHumanoidHeadLayer() @ L29

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

参数:

说明:

TODO

public static LayerDefinition createMobHeadLayer() @ L39

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

参数:

说明:

TODO

public void setupAnim(SkullModelBase.State state) @ L44

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

参数:

  • state: SkullModelBase.State

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class SkullModel extends SkullModelBase {
    protected final ModelPart head;
 
    public SkullModel(ModelPart root) {
        super(root);
        this.head = root.getChild("head");
    }
 
    public static MeshDefinition createHeadModel() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO);
        return mesh;
    }
 
    public static LayerDefinition createHumanoidHeadLayer() {
        MeshDefinition mesh = createHeadModel();
        PartDefinition root = mesh.getRoot();
        root.getChild("head")
            .addOrReplaceChild(
                "hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.25F)), PartPose.ZERO
            );
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public static LayerDefinition createMobHeadLayer() {
        MeshDefinition mesh = createHeadModel();
        return LayerDefinition.create(mesh, 64, 32);
    }
 
    public void setupAnim(SkullModelBase.State state) {
        super.setupAnim(state);
        this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
        this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
    }
}

引用的其他类

  • ModelPart

    • 引用位置: 参数/字段
  • CubeDeformation

    • 引用位置: 构造调用
    • 关联成员: CubeDeformation()
  • CubeListBuilder

    • 引用位置: 方法调用
    • 关联成员: CubeListBuilder.create()
  • LayerDefinition

    • 引用位置: 方法调用/返回值
    • 关联成员: LayerDefinition.create()
  • MeshDefinition

    • 引用位置: 构造调用/返回值
    • 关联成员: MeshDefinition()
  • SkullModelBase

    • 引用位置: 参数/继承