AdultFelineModel.java

net.minecraft.client.model.animal.feline.AdultFelineModel

信息

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

    TODO

字段/常量

  • XO

    • 类型: float
    • 修饰符: private static final
    • 源码定位: L16
    • 说明:

      TODO

  • YO

    • 类型: float
    • 修饰符: private static final
    • 源码定位: L17
    • 说明:

      TODO

  • ZO

    • 类型: float
    • 修饰符: private static final
    • 源码定位: L18
    • 说明:

      TODO

  • BACK_LEG_Y

    • 类型: float
    • 修饰符: protected static final
    • 源码定位: L19
    • 说明:

      TODO

  • BACK_LEG_Z

    • 类型: float
    • 修饰符: protected static final
    • 源码定位: L20
    • 说明:

      TODO

  • FRONT_LEG_Y

    • 类型: float
    • 修饰符: protected static final
    • 源码定位: L21
    • 说明:

      TODO

  • FRONT_LEG_Z

    • 类型: float
    • 修饰符: private static final
    • 源码定位: L22
    • 说明:

      TODO

内部类/嵌套类型

构造器

public AdultFelineModel(ModelPart root) @ L24

  • 构造器名:AdultFelineModel
  • 源码定位:L24
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static MeshDefinition createBodyMesh(CubeDeformation g) @ L28

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

参数:

  • g: CubeDeformation

说明:

TODO

public void setupAnim(T state) @ L63

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

参数:

  • state: T

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class AdultFelineModel<T extends FelineRenderState> extends AbstractFelineModel<T> {
    private static final float XO = 0.0F;
    private static final float YO = 16.0F;
    private static final float ZO = -9.0F;
    protected static final float BACK_LEG_Y = 18.0F;
    protected static final float BACK_LEG_Z = 5.0F;
    protected static final float FRONT_LEG_Y = 14.1F;
    private static final float FRONT_LEG_Z = -5.0F;
 
    public AdultFelineModel(ModelPart root) {
        super(root);
    }
 
    public static MeshDefinition createBodyMesh(CubeDeformation g) {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        CubeDeformation tail_g = new CubeDeformation(-0.02F);
        root.addOrReplaceChild(
            "head",
            CubeListBuilder.create()
                .addBox("main", -2.5F, -2.0F, -3.0F, 5.0F, 4.0F, 5.0F, g)
                .addBox("nose", -1.5F, -0.001F, -4.0F, 3, 2, 2, g, 0, 24)
                .addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2, g, 0, 10)
                .addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2, g, 6, 10),
            PartPose.offset(0.0F, 15.0F, -9.0F)
        );
        root.addOrReplaceChild(
            "body",
            CubeListBuilder.create().texOffs(20, 0).addBox(-2.0F, 3.0F, -8.0F, 4.0F, 16.0F, 6.0F, g),
            PartPose.offsetAndRotation(0.0F, 12.0F, -10.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "tail1",
            CubeListBuilder.create().texOffs(0, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, g),
            PartPose.offsetAndRotation(0.0F, 15.0F, 8.0F, 0.9F, 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "tail2", CubeListBuilder.create().texOffs(4, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, tail_g), PartPose.offset(0.0F, 20.0F, 14.0F)
        );
        CubeListBuilder hindLeg = CubeListBuilder.create().texOffs(8, 13).addBox(-1.0F, 0.0F, 1.0F, 2.0F, 6.0F, 2.0F, g);
        root.addOrReplaceChild("left_hind_leg", hindLeg, PartPose.offset(1.1F, 18.0F, 5.0F));
        root.addOrReplaceChild("right_hind_leg", hindLeg, PartPose.offset(-1.1F, 18.0F, 5.0F));
        CubeListBuilder frontLeg = CubeListBuilder.create().texOffs(40, 0).addBox(-1.0F, 0.0F, 0.0F, 2.0F, 10.0F, 2.0F, g);
        root.addOrReplaceChild("left_front_leg", frontLeg, PartPose.offset(1.2F, 14.1F, -5.0F));
        root.addOrReplaceChild("right_front_leg", frontLeg, PartPose.offset(-1.2F, 14.1F, -5.0F));
        return mesh;
    }
 
    public void setupAnim(T state) {
        super.setupAnim(state);
        float ageScale = state.ageScale;
        if (state.isCrouching) {
            this.body.y += 1.0F * ageScale;
            this.head.y += 2.0F * ageScale;
            this.tail1.y += 1.0F * ageScale;
            this.tail2.y += -4.0F * ageScale;
            this.tail2.z += 2.0F * ageScale;
            this.tail1.xRot = (float) (Math.PI / 2);
            this.tail2.xRot = (float) (Math.PI / 2);
        } else if (state.isSprinting) {
            this.tail2.y = this.tail1.y;
            this.tail2.z += 2.0F * ageScale;
            this.tail1.xRot = (float) (Math.PI / 2);
            this.tail2.xRot = (float) (Math.PI / 2);
        }
 
        this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
        this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
        if (!state.isSitting) {
            this.body.xRot = (float) (Math.PI / 2);
            float animationSpeed = state.walkAnimationSpeed;
            float animationPos = state.walkAnimationPos;
            if (state.isSprinting) {
                this.leftHindLeg.xRot = Mth.cos(animationPos * 0.6662F) * animationSpeed;
                this.rightHindLeg.xRot = Mth.cos(animationPos * 0.6662F + 0.3F) * animationSpeed;
                this.leftFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI + 0.3F) * animationSpeed;
                this.rightFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * animationSpeed;
                this.tail2.xRot = 1.7278761F + (float) (Math.PI / 10) * Mth.cos(animationPos) * animationSpeed;
            } else {
                this.leftHindLeg.xRot = Mth.cos(animationPos * 0.6662F) * animationSpeed;
                this.rightHindLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * animationSpeed;
                this.leftFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * animationSpeed;
                this.rightFrontLeg.xRot = Mth.cos(animationPos * 0.6662F) * animationSpeed;
                if (!state.isCrouching) {
                    this.tail2.xRot = 1.7278761F + (float) (Math.PI / 4) * Mth.cos(animationPos) * animationSpeed;
                } else {
                    this.tail2.xRot = 1.7278761F + 0.47123894F * Mth.cos(animationPos) * animationSpeed;
                }
            }
        }
 
        if (state.isSitting) {
            this.body.xRot = (float) (Math.PI / 4);
            this.body.y += -4.0F * ageScale;
            this.body.z += 5.0F * ageScale;
            this.head.y += -3.3F * ageScale;
            this.head.z += 1.0F * ageScale;
            this.tail1.y += 8.0F * ageScale;
            this.tail1.z += -2.0F * ageScale;
            this.tail2.y += 2.0F * ageScale;
            this.tail2.z += -0.8F * ageScale;
            this.tail1.xRot = 1.7278761F;
            this.tail2.xRot = 2.670354F;
            this.leftFrontLeg.xRot = (float) (-Math.PI / 20);
            this.leftFrontLeg.y += 2.0F * ageScale;
            this.leftFrontLeg.z -= 2.0F * ageScale;
            this.rightFrontLeg.xRot = (float) (-Math.PI / 20);
            this.rightFrontLeg.y += 2.0F * ageScale;
            this.rightFrontLeg.z -= 2.0F * ageScale;
            this.leftHindLeg.xRot = (float) (-Math.PI / 2);
            this.leftHindLeg.y += 3.0F * ageScale;
            this.leftHindLeg.z -= 4.0F * ageScale;
            this.rightHindLeg.xRot = (float) (-Math.PI / 2);
            this.rightHindLeg.y += 3.0F * ageScale;
            this.rightHindLeg.z -= 4.0F * ageScale;
        }
 
        if (state.lieDownAmount > 0.0F) {
            this.head.zRot = Mth.rotLerp(state.lieDownAmount, this.head.zRot, -1.2707963F);
            this.head.yRot = Mth.rotLerp(state.lieDownAmount, this.head.yRot, 1.2707963F);
            this.leftFrontLeg.xRot = -1.2707963F;
            this.rightFrontLeg.xRot = -0.47079635F;
            this.rightFrontLeg.zRot = -0.2F;
            this.rightFrontLeg.x += ageScale;
            this.leftHindLeg.xRot = -0.4F;
            this.rightHindLeg.xRot = 0.5F;
            this.rightHindLeg.zRot = -0.5F;
            this.rightHindLeg.x += 0.8F * ageScale;
            this.rightHindLeg.y += 2.0F * ageScale;
            this.tail1.xRot = Mth.rotLerp(state.lieDownAmountTail, this.tail1.xRot, 0.8F);
            this.tail2.xRot = Mth.rotLerp(state.lieDownAmountTail, this.tail2.xRot, -0.4F);
        }
 
        if (state.relaxStateOneAmount > 0.0F) {
            this.head.xRot = Mth.rotLerp(state.relaxStateOneAmount, this.head.xRot, -0.58177644F);
        }
    }
}

引用的其他类

  • AbstractFelineModel

    • 引用位置: 继承
  • ModelPart

    • 引用位置: 参数
  • PartPose

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

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

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

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

    • 引用位置: 方法调用
    • 关联成员: Mth.cos(), Mth.rotLerp()