PolarBearModel.java

net.minecraft.client.model.animal.polarbear.PolarBearModel

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public PolarBearModel(ModelPart root) @ L17

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

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer() @ L21

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

参数:

说明:

TODO

public void setupAnim(PolarBearRenderState state) @ L57

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

参数:

  • state: PolarBearRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class PolarBearModel extends QuadrupedModel<PolarBearRenderState> {
    public PolarBearModel(ModelPart root) {
        super(root);
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild(
            "head",
            CubeListBuilder.create()
                .texOffs(0, 0)
                .addBox(-3.5F, -3.0F, -3.0F, 7.0F, 7.0F, 7.0F)
                .texOffs(0, 44)
                .addBox("mouth", -2.5F, 1.0F, -6.0F, 5.0F, 3.0F, 3.0F)
                .texOffs(26, 0)
                .addBox("right_ear", -4.5F, -4.0F, -1.0F, 2.0F, 2.0F, 1.0F)
                .texOffs(26, 0)
                .mirror()
                .addBox("left_ear", 2.5F, -4.0F, -1.0F, 2.0F, 2.0F, 1.0F),
            PartPose.offset(0.0F, 10.0F, -16.0F)
        );
        root.addOrReplaceChild(
            "body",
            CubeListBuilder.create()
                .texOffs(0, 19)
                .addBox(-5.0F, -13.0F, -7.0F, 14.0F, 14.0F, 11.0F)
                .texOffs(39, 0)
                .addBox(-4.0F, -25.0F, -7.0F, 12.0F, 12.0F, 10.0F),
            PartPose.offsetAndRotation(-2.0F, 9.0F, 12.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        int legSize = 10;
        CubeListBuilder hindLeg = CubeListBuilder.create().texOffs(50, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 10.0F, 8.0F);
        root.addOrReplaceChild("right_hind_leg", hindLeg, PartPose.offset(-4.5F, 14.0F, 6.0F));
        root.addOrReplaceChild("left_hind_leg", hindLeg, PartPose.offset(4.5F, 14.0F, 6.0F));
        CubeListBuilder frontLeg = CubeListBuilder.create().texOffs(50, 40).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 10.0F, 6.0F);
        root.addOrReplaceChild("right_front_leg", frontLeg, PartPose.offset(-3.5F, 14.0F, -8.0F));
        root.addOrReplaceChild("left_front_leg", frontLeg, PartPose.offset(3.5F, 14.0F, -8.0F));
        return LayerDefinition.create(mesh, 128, 64).apply(MeshTransformer.scaling(1.2F));
    }
 
    public void setupAnim(PolarBearRenderState state) {
        super.setupAnim(state);
        float standScale = state.standScale * state.standScale;
        float bodyAgeScale = state.ageScale;
        this.body.xRot -= standScale * (float) Math.PI * 0.35F;
        this.body.y += standScale * bodyAgeScale * 2.0F;
        this.rightFrontLeg.y -= standScale * bodyAgeScale * 20.0F;
        this.rightFrontLeg.z += standScale * bodyAgeScale * 4.0F;
        this.rightFrontLeg.xRot -= standScale * (float) Math.PI * 0.45F;
        this.leftFrontLeg.y = this.rightFrontLeg.y;
        this.leftFrontLeg.z = this.rightFrontLeg.z;
        this.leftFrontLeg.xRot -= standScale * (float) Math.PI * 0.45F;
        this.head.y -= standScale * 24.0F;
        this.head.z += standScale * 13.0F;
        this.head.xRot += standScale * (float) Math.PI * 0.15F;
    }
}

引用的其他类