DolphinModel.java

net.minecraft.client.model.animal.dolphin.DolphinModel

信息

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

    TODO

字段/常量

  • BABY_TRANSFORMER

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

      TODO

  • body

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

      TODO

  • tail

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

      TODO

  • tailFin

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

      TODO

内部类/嵌套类型

构造器

public DolphinModel(ModelPart root) @ L23

  • 构造器名:DolphinModel
  • 源码定位:L23
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer() @ L30

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

参数:

说明:

TODO

public void setupAnim(DolphinRenderState state) @ L68

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

参数:

  • state: DolphinRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class DolphinModel extends EntityModel<DolphinRenderState> {
    public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F);
    private final ModelPart body;
    private final ModelPart tail;
    private final ModelPart tailFin;
 
    public DolphinModel(ModelPart root) {
        super(root);
        this.body = root.getChild("body");
        this.tail = this.body.getChild("tail");
        this.tailFin = this.tail.getChild("tail_fin");
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        float offY = 18.0F;
        float offZ = -8.0F;
        PartDefinition body = root.addOrReplaceChild(
            "body", CubeListBuilder.create().texOffs(22, 0).addBox(-4.0F, -7.0F, 0.0F, 8.0F, 7.0F, 13.0F), PartPose.offset(0.0F, 22.0F, -5.0F)
        );
        body.addOrReplaceChild(
            "back_fin",
            CubeListBuilder.create().texOffs(51, 0).addBox(-0.5F, 0.0F, 8.0F, 1.0F, 4.0F, 5.0F),
            PartPose.rotation((float) (Math.PI / 3), 0.0F, 0.0F)
        );
        body.addOrReplaceChild(
            "left_fin",
            CubeListBuilder.create().texOffs(48, 20).mirror().addBox(-0.5F, -4.0F, 0.0F, 1.0F, 4.0F, 7.0F),
            PartPose.offsetAndRotation(2.0F, -2.0F, 4.0F, (float) (Math.PI / 3), 0.0F, (float) (Math.PI * 2.0 / 3.0))
        );
        body.addOrReplaceChild(
            "right_fin",
            CubeListBuilder.create().texOffs(48, 20).addBox(-0.5F, -4.0F, 0.0F, 1.0F, 4.0F, 7.0F),
            PartPose.offsetAndRotation(-2.0F, -2.0F, 4.0F, (float) (Math.PI / 3), 0.0F, (float) (-Math.PI * 2.0 / 3.0))
        );
        PartDefinition tail = body.addOrReplaceChild(
            "tail",
            CubeListBuilder.create().texOffs(0, 19).addBox(-2.0F, -2.5F, 0.0F, 4.0F, 5.0F, 11.0F),
            PartPose.offsetAndRotation(0.0F, -2.5F, 11.0F, -0.10471976F, 0.0F, 0.0F)
        );
        tail.addOrReplaceChild(
            "tail_fin", CubeListBuilder.create().texOffs(19, 20).addBox(-5.0F, -0.5F, 0.0F, 10.0F, 1.0F, 6.0F), PartPose.offset(0.0F, 0.0F, 9.0F)
        );
        PartDefinition head = body.addOrReplaceChild(
            "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -3.0F, -3.0F, 8.0F, 7.0F, 6.0F), PartPose.offset(0.0F, -4.0F, -3.0F)
        );
        head.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(0, 13).addBox(-1.0F, 2.0F, -7.0F, 2.0F, 2.0F, 4.0F), PartPose.ZERO);
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public void setupAnim(DolphinRenderState state) {
        super.setupAnim(state);
        this.body.xRot = state.xRot * (float) (Math.PI / 180.0);
        this.body.yRot = state.yRot * (float) (Math.PI / 180.0);
        if (state.isMoving) {
            this.body.xRot = this.body.xRot + (-0.05F - 0.05F * Mth.cos(state.ageInTicks * 0.3F));
            this.tail.xRot = -0.1F * Mth.cos(state.ageInTicks * 0.3F);
            this.tailFin.xRot = -0.2F * Mth.cos(state.ageInTicks * 0.3F);
        }
    }
}

引用的其他类

  • EntityModel

    • 引用位置: 继承
  • ModelPart

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

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

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

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

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

    • 引用位置: 字段/方法调用
    • 关联成员: MeshTransformer.scaling()
  • DolphinRenderState

    • 引用位置: 参数
  • Mth

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