EndermanModel.java

net.minecraft.client.model.monster.enderman.EndermanModel

信息

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

    TODO

字段/常量

内部类/嵌套类型

构造器

public EndermanModel(ModelPart root) @ L18

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

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer() @ L22

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

参数:

说明:

TODO

public void setupAnim(T state) @ L50

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

参数:

  • state: T

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class EndermanModel<T extends EndermanRenderState> extends HumanoidModel<T> {
    public EndermanModel(ModelPart root) {
        super(root);
    }
 
    public static LayerDefinition createBodyLayer() {
        float yOffset = -14.0F;
        MeshDefinition mesh = HumanoidModel.createMesh(CubeDeformation.NONE, -14.0F);
        PartDefinition root = mesh.getRoot();
        PartDefinition head = root.addOrReplaceChild(
            "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.offset(0.0F, -13.0F, 0.0F)
        );
        head.addOrReplaceChild(
            "hat", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(-0.5F)), PartPose.ZERO
        );
        root.addOrReplaceChild(
            "body", CubeListBuilder.create().texOffs(32, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F), PartPose.offset(0.0F, -14.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "right_arm", CubeListBuilder.create().texOffs(56, 0).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 30.0F, 2.0F), PartPose.offset(-5.0F, -12.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_arm", CubeListBuilder.create().texOffs(56, 0).mirror().addBox(-1.0F, -2.0F, -1.0F, 2.0F, 30.0F, 2.0F), PartPose.offset(5.0F, -12.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "right_leg", CubeListBuilder.create().texOffs(56, 0).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 30.0F, 2.0F), PartPose.offset(-2.0F, -5.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_leg", CubeListBuilder.create().texOffs(56, 0).mirror().addBox(-1.0F, 0.0F, -1.0F, 2.0F, 30.0F, 2.0F), PartPose.offset(2.0F, -5.0F, 0.0F)
        );
        return LayerDefinition.create(mesh, 64, 32);
    }
 
    public void setupAnim(T state) {
        super.setupAnim(state);
        this.head.visible = true;
        this.rightArm.xRot *= 0.5F;
        this.leftArm.xRot *= 0.5F;
        this.rightLeg.xRot *= 0.5F;
        this.leftLeg.xRot *= 0.5F;
        float max = 0.4F;
        this.rightArm.xRot = Mth.clamp(this.rightArm.xRot, -0.4F, 0.4F);
        this.leftArm.xRot = Mth.clamp(this.leftArm.xRot, -0.4F, 0.4F);
        this.rightLeg.xRot = Mth.clamp(this.rightLeg.xRot, -0.4F, 0.4F);
        this.leftLeg.xRot = Mth.clamp(this.leftLeg.xRot, -0.4F, 0.4F);
        if (!state.carriedBlock.isEmpty()) {
            this.rightArm.xRot = -0.5F;
            this.leftArm.xRot = -0.5F;
            this.rightArm.zRot = 0.05F;
            this.leftArm.zRot = -0.05F;
        }
 
        if (state.isCreepy) {
            float amt = 5.0F;
            this.head.y -= 5.0F;
            this.hat.y += 5.0F;
        }
    }
}

引用的其他类

  • HumanoidModel

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

    • 引用位置: 参数
  • PartPose

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

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

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

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

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