CreakingModel.java

net.minecraft.client.model.monster.creaking.CreakingModel

信息

  • 全限定名:net.minecraft.client.model.monster.creaking.CreakingModel
  • 类型:public class
  • 包:net.minecraft.client.model.monster.creaking
  • 源码路径:src/main/java/net/minecraft/client/model/monster/creaking/CreakingModel.java
  • 起始行号:L18
  • 继承:EntityModel
  • 职责:

    TODO

字段/常量

  • head

    • 类型: ModelPart
    • 修饰符: private final
    • 源码定位: L19
    • 说明:

      TODO

  • walkAnimation

    • 类型: KeyframeAnimation
    • 修饰符: private final
    • 源码定位: L20
    • 说明:

      TODO

  • attackAnimation

    • 类型: KeyframeAnimation
    • 修饰符: private final
    • 源码定位: L21
    • 说明:

      TODO

  • invulnerableAnimation

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

      TODO

  • deathAnimation

    • 类型: KeyframeAnimation
    • 修饰符: private final
    • 源码定位: L23
    • 说明:

      TODO

内部类/嵌套类型

构造器

public CreakingModel(ModelPart roots) @ L25

  • 构造器名:CreakingModel
  • 源码定位:L25
  • 修饰符:public

参数:

  • roots: ModelPart

说明:

TODO

方法

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

private static MeshDefinition createMesh() @ L36

  • 方法名:createMesh
  • 源码定位:L36
  • 返回类型:MeshDefinition
  • 修饰符:private static

参数:

说明:

TODO

public static LayerDefinition createBodyLayer() @ L102

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

参数:

说明:

TODO

public static LayerDefinition createEyesLayer() @ L107

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

参数:

说明:

TODO

public void setupAnim(CreakingRenderState state) @ L113

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

参数:

  • state: CreakingRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class CreakingModel extends EntityModel<CreakingRenderState> {
    private final ModelPart head;
    private final KeyframeAnimation walkAnimation;
    private final KeyframeAnimation attackAnimation;
    private final KeyframeAnimation invulnerableAnimation;
    private final KeyframeAnimation deathAnimation;
 
    public CreakingModel(ModelPart roots) {
        super(roots);
        ModelPart root = roots.getChild("root");
        ModelPart upperBody = root.getChild("upper_body");
        this.head = upperBody.getChild("head");
        this.walkAnimation = CreakingAnimation.CREAKING_WALK.bake(root);
        this.attackAnimation = CreakingAnimation.CREAKING_ATTACK.bake(root);
        this.invulnerableAnimation = CreakingAnimation.CREAKING_INVULNERABLE.bake(root);
        this.deathAnimation = CreakingAnimation.CREAKING_DEATH.bake(root);
    }
 
    private static MeshDefinition createMesh() {
        MeshDefinition meshDefinition = new MeshDefinition();
        PartDefinition partDefinition = meshDefinition.getRoot();
        PartDefinition root = partDefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
        PartDefinition upperBody = root.addOrReplaceChild("upper_body", CubeListBuilder.create(), PartPose.offset(-1.0F, -19.0F, 0.0F));
        upperBody.addOrReplaceChild(
            "head",
            CubeListBuilder.create()
                .texOffs(0, 0)
                .addBox(-3.0F, -10.0F, -3.0F, 6.0F, 10.0F, 6.0F)
                .texOffs(28, 31)
                .addBox(-3.0F, -13.0F, -3.0F, 6.0F, 3.0F, 6.0F)
                .texOffs(12, 40)
                .addBox(3.0F, -13.0F, 0.0F, 9.0F, 14.0F, 0.0F)
                .texOffs(34, 12)
                .addBox(-12.0F, -14.0F, 0.0F, 9.0F, 14.0F, 0.0F),
            PartPose.offset(-3.0F, -11.0F, 0.0F)
        );
        upperBody.addOrReplaceChild(
            "body",
            CubeListBuilder.create().texOffs(0, 16).addBox(0.0F, -3.0F, -3.0F, 6.0F, 13.0F, 5.0F).texOffs(24, 0).addBox(-6.0F, -4.0F, -3.0F, 6.0F, 7.0F, 5.0F),
            PartPose.offset(0.0F, -7.0F, 1.0F)
        );
        upperBody.addOrReplaceChild(
            "right_arm",
            CubeListBuilder.create()
                .texOffs(22, 13)
                .addBox(-2.0F, -1.5F, -1.5F, 3.0F, 21.0F, 3.0F)
                .texOffs(46, 0)
                .addBox(-2.0F, 19.5F, -1.5F, 3.0F, 4.0F, 3.0F),
            PartPose.offset(-7.0F, -9.5F, 1.5F)
        );
        upperBody.addOrReplaceChild(
            "left_arm",
            CubeListBuilder.create()
                .texOffs(30, 40)
                .addBox(0.0F, -1.0F, -1.5F, 3.0F, 16.0F, 3.0F)
                .texOffs(52, 12)
                .addBox(0.0F, -5.0F, -1.5F, 3.0F, 4.0F, 3.0F)
                .texOffs(52, 19)
                .addBox(0.0F, 15.0F, -1.5F, 3.0F, 4.0F, 3.0F),
            PartPose.offset(6.0F, -9.0F, 0.5F)
        );
        root.addOrReplaceChild(
            "left_leg",
            CubeListBuilder.create()
                .texOffs(42, 40)
                .addBox(-1.5F, 0.0F, -1.5F, 3.0F, 16.0F, 3.0F)
                .texOffs(45, 55)
                .addBox(-1.5F, 15.7F, -4.5F, 5.0F, 0.0F, 9.0F),
            PartPose.offset(1.5F, -16.0F, 0.5F)
        );
        root.addOrReplaceChild(
            "right_leg",
            CubeListBuilder.create()
                .texOffs(0, 34)
                .addBox(-3.0F, -1.5F, -1.5F, 3.0F, 19.0F, 3.0F)
                .texOffs(45, 46)
                .addBox(-5.0F, 17.2F, -4.5F, 5.0F, 0.0F, 9.0F)
                .texOffs(12, 34)
                .addBox(-3.0F, -4.5F, -1.5F, 3.0F, 3.0F, 3.0F),
            PartPose.offset(-1.0F, -17.5F, 0.5F)
        );
        return meshDefinition;
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = createMesh();
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public static LayerDefinition createEyesLayer() {
        MeshDefinition mesh = createMesh();
        mesh.getRoot().retainExactParts(Set.of("head"));
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public void setupAnim(CreakingRenderState state) {
        super.setupAnim(state);
        this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
        this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
        if (state.canMove) {
            this.walkAnimation.applyWalk(state.walkAnimationPos, state.walkAnimationSpeed, 1.0F, 1.0F);
        }
 
        this.attackAnimation.apply(state.attackAnimationState, state.ageInTicks);
        this.invulnerableAnimation.apply(state.invulnerabilityAnimationState, state.ageInTicks);
        this.deathAnimation.apply(state.deathAnimationState, state.ageInTicks);
    }
}

引用的其他类