DrownedModel.java

net.minecraft.client.model.monster.zombie.DrownedModel

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public DrownedModel(ModelPart root) @ L18

  • 构造器名:DrownedModel
  • 源码定位:L18
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer(CubeDeformation g) @ L22

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

参数:

  • g: CubeDeformation

说明:

TODO

public void setupAnim(ZombieRenderState state) @ L34

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

参数:

  • state: ZombieRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class DrownedModel extends ZombieModel<ZombieRenderState> {
    public DrownedModel(ModelPart root) {
        super(root);
    }
 
    public static LayerDefinition createBodyLayer(CubeDeformation g) {
        MeshDefinition mesh = HumanoidModel.createMesh(g, 0.0F);
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild(
            "left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, g), PartPose.offset(5.0F, 2.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_leg", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, g), PartPose.offset(1.9F, 12.0F, 0.0F)
        );
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    @Override
    public void setupAnim(ZombieRenderState state) {
        super.setupAnim(state);
        if (state.leftArmPose == HumanoidModel.ArmPose.THROW_TRIDENT) {
            this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) Math.PI;
            this.leftArm.yRot = 0.0F;
        }
 
        if (state.rightArmPose == HumanoidModel.ArmPose.THROW_TRIDENT) {
            this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) Math.PI;
            this.rightArm.yRot = 0.0F;
        }
 
        float swimAmount = state.swimAmount;
        if (swimAmount > 0.0F) {
            this.rightArm.xRot = Mth.rotLerpRad(swimAmount, this.rightArm.xRot, (float) (-Math.PI * 4.0 / 5.0))
                + swimAmount * 0.35F * Mth.sin(0.1F * state.ageInTicks);
            this.leftArm.xRot = Mth.rotLerpRad(swimAmount, this.leftArm.xRot, (float) (-Math.PI * 4.0 / 5.0))
                - swimAmount * 0.35F * Mth.sin(0.1F * state.ageInTicks);
            this.rightArm.zRot = Mth.rotLerpRad(swimAmount, this.rightArm.zRot, -0.15F);
            this.leftArm.zRot = Mth.rotLerpRad(swimAmount, this.leftArm.zRot, 0.15F);
            this.leftLeg.xRot = this.leftLeg.xRot - swimAmount * 0.55F * Mth.sin(0.1F * state.ageInTicks);
            this.rightLeg.xRot = this.rightLeg.xRot + swimAmount * 0.55F * Mth.sin(0.1F * state.ageInTicks);
            this.head.xRot = 0.0F;
        }
    }
}

引用的其他类

  • HumanoidModel

    • 引用位置: 方法调用
    • 关联成员: HumanoidModel.createMesh()
  • ModelPart

    • 引用位置: 参数
  • PartPose

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

    • 引用位置: 参数
  • CubeListBuilder

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

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

    • 引用位置: 继承
  • ZombieRenderState

    • 引用位置: 参数
  • Mth

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