BabyStriderModel.java

net.minecraft.client.model.monster.strider.BabyStriderModel

信息

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

    TODO

字段/常量

  • FRONT_BRISTLE

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

      TODO

  • MIDDLE_BRISTLE

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

      TODO

  • BACK_BRISTLE

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

      TODO

  • frontBristle

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

      TODO

  • middleBristle

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

      TODO

  • bottomBristle

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

      TODO

内部类/嵌套类型

构造器

public BabyStriderModel(ModelPart root) @ L23

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

参数:

  • root: ModelPart

说明:

TODO

方法

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

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

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

参数:

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

说明:

TODO

public static LayerDefinition createBodyLayer() @ L44

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class BabyStriderModel extends StriderModel {
    private static final String FRONT_BRISTLE = "bristle2";
    private static final String MIDDLE_BRISTLE = "bristle1";
    private static final String BACK_BRISTLE = "bristle0";
    private final ModelPart frontBristle = this.body.getChild("bristle2");
    private final ModelPart middleBristle = this.body.getChild("bristle1");
    private final ModelPart bottomBristle = this.body.getChild("bristle0");
 
    public BabyStriderModel(ModelPart root) {
        super(root);
    }
 
    @Override
    protected void customAnimations(float animationPos, float animationSpeed, float ageInTicks) {
        this.body.y = 17.25F;
        this.body.y = this.body.y - 1.0F * Mth.cos(animationPos * 1.5F) * 2.0F * animationSpeed;
        this.leftLeg.y = 20.0F + 2.0F * Mth.sin(animationPos * 1.5F * 0.5F + (float) Math.PI) * 2.0F * animationSpeed;
        this.rightLeg.y = 20.0F + 2.0F * Mth.sin(animationPos * 1.5F * 0.5F) * 2.0F * animationSpeed;
        float bristleFlow = Mth.cos(animationPos * 1.5F + (float) Math.PI) * animationSpeed;
        this.animateBristle(
            ageInTicks,
            bristleFlow,
            this.frontBristle,
            this.middleBristle,
            this.bottomBristle,
            (modelPart, rotation) -> modelPart.xRot = modelPart.xRot + rotation
        );
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        PartDefinition body = root.addOrReplaceChild(
            "body",
            CubeListBuilder.create().texOffs(0, 0).addBox(-3.5F, -3.75F, -4.0F, 7.0F, 7.0F, 8.0F, new CubeDeformation(0.0F)),
            PartPose.offset(0.0F, 16.75F, 0.0F)
        );
        root.addOrReplaceChild(
            "right_leg",
            CubeListBuilder.create().texOffs(0, 24).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)),
            PartPose.offset(-1.5F, 20.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_leg",
            CubeListBuilder.create().texOffs(8, 24).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)),
            PartPose.offset(1.5F, 20.0F, 0.0F)
        );
        body.addOrReplaceChild(
            "bristle0",
            CubeListBuilder.create().texOffs(0, 21).addBox(-3.5F, -2.5F, 0.0F, 7.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)),
            PartPose.offset(0.0F, -4.25F, 2.0F)
        );
        body.addOrReplaceChild(
            "bristle1",
            CubeListBuilder.create().texOffs(0, 18).addBox(-3.5F, -2.5F, 0.0F, 7.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)),
            PartPose.offset(0.0F, -4.25F, 0.0F)
        );
        body.addOrReplaceChild(
            "bristle2",
            CubeListBuilder.create().texOffs(0, 15).addBox(-3.5F, -2.5F, 0.0F, 7.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)),
            PartPose.offset(0.0F, -4.25F, -2.0F)
        );
        return LayerDefinition.create(mesh, 32, 32);
    }
}

引用的其他类

  • ModelPart

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

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

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

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

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

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

    • 引用位置: 继承
  • Mth

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