GoatModel.java

net.minecraft.client.model.animal.goat.GoatModel

信息

  • 全限定名:net.minecraft.client.model.animal.goat.GoatModel
  • 类型:public class
  • 包:net.minecraft.client.model.animal.goat
  • 源码路径:src/main/java/net/minecraft/client/model/animal/goat/GoatModel.java
  • 起始行号:L15
  • 继承:QuadrupedModel
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public GoatModel(ModelPart root) @ L16

  • 构造器名:GoatModel
  • 源码定位:L16
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer() @ L20

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

参数:

说明:

TODO

public void setupAnim(GoatRenderState state) @ L70

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

参数:

  • state: GoatRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GoatModel extends QuadrupedModel<GoatRenderState> {
    public GoatModel(ModelPart root) {
        super(root);
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        PartDefinition head = root.addOrReplaceChild(
            "head",
            CubeListBuilder.create()
                .texOffs(2, 61)
                .addBox("right ear", -6.0F, -11.0F, -10.0F, 3.0F, 2.0F, 1.0F)
                .texOffs(2, 61)
                .mirror()
                .addBox("left ear", 2.0F, -11.0F, -10.0F, 3.0F, 2.0F, 1.0F)
                .texOffs(23, 52)
                .addBox("goatee", -0.5F, -3.0F, -14.0F, 0.0F, 7.0F, 5.0F),
            PartPose.offset(1.0F, 14.0F, 0.0F)
        );
        head.addOrReplaceChild(
            "left_horn", CubeListBuilder.create().texOffs(12, 55).addBox(-0.01F, -16.0F, -10.0F, 2.0F, 7.0F, 2.0F), PartPose.offset(0.0F, 0.0F, 0.0F)
        );
        head.addOrReplaceChild(
            "right_horn", CubeListBuilder.create().texOffs(12, 55).addBox(-2.99F, -16.0F, -10.0F, 2.0F, 7.0F, 2.0F), PartPose.offset(0.0F, 0.0F, 0.0F)
        );
        head.addOrReplaceChild(
            "nose",
            CubeListBuilder.create().texOffs(34, 46).addBox(-3.0F, -4.0F, -8.0F, 5.0F, 7.0F, 10.0F),
            PartPose.offsetAndRotation(0.0F, -8.0F, -8.0F, 0.9599F, 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "body",
            CubeListBuilder.create()
                .texOffs(1, 1)
                .addBox(-4.0F, -17.0F, -7.0F, 9.0F, 11.0F, 16.0F)
                .texOffs(0, 28)
                .addBox(-5.0F, -18.0F, -8.0F, 11.0F, 14.0F, 11.0F),
            PartPose.offset(0.0F, 24.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_hind_leg", CubeListBuilder.create().texOffs(36, 29).addBox(0.0F, 4.0F, 0.0F, 3.0F, 6.0F, 3.0F), PartPose.offset(1.0F, 14.0F, 4.0F)
        );
        root.addOrReplaceChild(
            "right_hind_leg", CubeListBuilder.create().texOffs(49, 29).addBox(0.0F, 4.0F, 0.0F, 3.0F, 6.0F, 3.0F), PartPose.offset(-3.0F, 14.0F, 4.0F)
        );
        root.addOrReplaceChild(
            "left_front_leg", CubeListBuilder.create().texOffs(49, 2).addBox(0.0F, 0.0F, 0.0F, 3.0F, 10.0F, 3.0F), PartPose.offset(1.0F, 14.0F, -6.0F)
        );
        root.addOrReplaceChild(
            "right_front_leg", CubeListBuilder.create().texOffs(35, 2).addBox(0.0F, 0.0F, 0.0F, 3.0F, 10.0F, 3.0F), PartPose.offset(-3.0F, 14.0F, -6.0F)
        );
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public void setupAnim(GoatRenderState state) {
        super.setupAnim(state);
        this.head.getChild("left_horn").visible = state.hasLeftHorn;
        this.head.getChild("right_horn").visible = state.hasRightHorn;
        if (state.rammingXHeadRot != 0.0F) {
            this.head.xRot = state.rammingXHeadRot;
        }
    }
}

引用的其他类

  • QuadrupedModel

    • 引用位置: 继承
  • ModelPart

    • 引用位置: 参数
  • PartPose

    • 引用位置: 方法调用
    • 关联成员: PartPose.offset(), PartPose.offsetAndRotation()
  • CubeListBuilder

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

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

    • 引用位置: 构造调用
    • 关联成员: MeshDefinition()
  • GoatRenderState

    • 引用位置: 参数