AdultStriderModel.java

net.minecraft.client.model.monster.strider.AdultStriderModel

信息

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

    TODO

字段/常量

  • RIGHT_BOTTOM_BRISTLE

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

      TODO

  • RIGHT_MIDDLE_BRISTLE

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

      TODO

  • RIGHT_TOP_BRISTLE

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

      TODO

  • LEFT_TOP_BRISTLE

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

      TODO

  • LEFT_MIDDLE_BRISTLE

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

      TODO

  • LEFT_BOTTOM_BRISTLE

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

      TODO

  • rightBottomBristle

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

      TODO

  • rightMiddleBristle

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

      TODO

  • rightTopBristle

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

      TODO

  • leftTopBristle

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

      TODO

  • leftMiddleBristle

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

      TODO

  • leftBottomBristle

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

      TODO

内部类/嵌套类型

构造器

public AdultStriderModel(ModelPart root) @ L28

  • 构造器名:AdultStriderModel
  • 源码定位:L28
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

protected void customAnimations(float animationPos, float animationSpeed, float ageInTicks) @ L32

  • 方法名:customAnimations
  • 源码定位:L32
  • 返回类型:void
  • 修饰符:protected

参数:

  • animationPos: float
  • animationSpeed: float
  • ageInTicks: float

说明:

TODO

public static LayerDefinition createBodyLayer() @ L63

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class AdultStriderModel extends StriderModel {
    private static final String RIGHT_BOTTOM_BRISTLE = "right_bottom_bristle";
    private static final String RIGHT_MIDDLE_BRISTLE = "right_middle_bristle";
    private static final String RIGHT_TOP_BRISTLE = "right_top_bristle";
    private static final String LEFT_TOP_BRISTLE = "left_top_bristle";
    private static final String LEFT_MIDDLE_BRISTLE = "left_middle_bristle";
    private static final String LEFT_BOTTOM_BRISTLE = "left_bottom_bristle";
    private final ModelPart rightBottomBristle = this.body.getChild("right_bottom_bristle");
    private final ModelPart rightMiddleBristle = this.body.getChild("right_middle_bristle");
    private final ModelPart rightTopBristle = this.body.getChild("right_top_bristle");
    private final ModelPart leftTopBristle = this.body.getChild("left_top_bristle");
    private final ModelPart leftMiddleBristle = this.body.getChild("left_middle_bristle");
    private final ModelPart leftBottomBristle = this.body.getChild("left_bottom_bristle");
 
    public AdultStriderModel(ModelPart root) {
        super(root);
    }
 
    @Override
    protected void customAnimations(float animationPos, float animationSpeed, float ageInTicks) {
        this.rightBottomBristle.zRot = -1.2217305F;
        this.rightMiddleBristle.zRot = -1.134464F;
        this.rightTopBristle.zRot = -0.87266463F;
        this.leftTopBristle.zRot = 0.87266463F;
        this.leftMiddleBristle.zRot = 1.134464F;
        this.leftBottomBristle.zRot = 1.2217305F;
        float bristleFlow = Mth.cos(animationPos * 1.5F + (float) Math.PI) * animationSpeed;
        this.animateBristle(
            ageInTicks,
            bristleFlow,
            this.rightTopBristle,
            this.rightMiddleBristle,
            this.rightBottomBristle,
            (modelPart, rotation) -> modelPart.zRot = modelPart.zRot + rotation
        );
        this.animateBristle(
            ageInTicks,
            bristleFlow,
            this.leftTopBristle,
            this.leftMiddleBristle,
            this.leftBottomBristle,
            (modelPart, rotation) -> modelPart.zRot = modelPart.zRot + rotation
        );
        this.body.y = 2.0F;
        this.body.y = this.body.y - 2.0F * Mth.cos(animationPos * 1.5F) * 2.0F * animationSpeed;
        this.leftLeg.y = 8.0F + 2.0F * Mth.sin(animationPos * 1.5F * 0.5F + (float) Math.PI) * 2.0F * animationSpeed;
        this.rightLeg.y = 8.0F + 2.0F * Mth.sin(animationPos * 1.5F * 0.5F) * 2.0F * animationSpeed;
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild(
            "right_leg", CubeListBuilder.create().texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F), PartPose.offset(-4.0F, 8.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_leg", CubeListBuilder.create().texOffs(0, 55).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F), PartPose.offset(4.0F, 8.0F, 0.0F)
        );
        PartDefinition body = root.addOrReplaceChild(
            "body", CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -6.0F, -8.0F, 16.0F, 14.0F, 16.0F), PartPose.offset(0.0F, 1.0F, 0.0F)
        );
        body.addOrReplaceChild(
            "right_bottom_bristle",
            CubeListBuilder.create().texOffs(16, 65).addBox(-12.0F, 0.0F, 0.0F, 12.0F, 0.0F, 16.0F, true),
            PartPose.offsetAndRotation(-8.0F, 4.0F, -8.0F, 0.0F, 0.0F, -1.2217305F)
        );
        body.addOrReplaceChild(
            "right_middle_bristle",
            CubeListBuilder.create().texOffs(16, 49).addBox(-12.0F, 0.0F, 0.0F, 12.0F, 0.0F, 16.0F, true),
            PartPose.offsetAndRotation(-8.0F, -1.0F, -8.0F, 0.0F, 0.0F, -1.134464F)
        );
        body.addOrReplaceChild(
            "right_top_bristle",
            CubeListBuilder.create().texOffs(16, 33).addBox(-12.0F, 0.0F, 0.0F, 12.0F, 0.0F, 16.0F, true),
            PartPose.offsetAndRotation(-8.0F, -5.0F, -8.0F, 0.0F, 0.0F, -0.87266463F)
        );
        body.addOrReplaceChild(
            "left_top_bristle",
            CubeListBuilder.create().texOffs(16, 33).addBox(0.0F, 0.0F, 0.0F, 12.0F, 0.0F, 16.0F),
            PartPose.offsetAndRotation(8.0F, -6.0F, -8.0F, 0.0F, 0.0F, 0.87266463F)
        );
        body.addOrReplaceChild(
            "left_middle_bristle",
            CubeListBuilder.create().texOffs(16, 49).addBox(0.0F, 0.0F, 0.0F, 12.0F, 0.0F, 16.0F),
            PartPose.offsetAndRotation(8.0F, -2.0F, -8.0F, 0.0F, 0.0F, 1.134464F)
        );
        body.addOrReplaceChild(
            "left_bottom_bristle",
            CubeListBuilder.create().texOffs(16, 65).addBox(0.0F, 0.0F, 0.0F, 12.0F, 0.0F, 16.0F),
            PartPose.offsetAndRotation(8.0F, 3.0F, -8.0F, 0.0F, 0.0F, 1.2217305F)
        );
        return LayerDefinition.create(mesh, 64, 128);
    }
}

引用的其他类

  • ModelPart

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

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

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

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

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

    • 引用位置: 继承
  • Mth

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