StriderModel.java

net.minecraft.client.model.monster.strider.StriderModel

信息

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

    TODO

字段/常量

  • SPEED

    • 类型: float
    • 修饰符: protected static final
    • 源码定位: L13
    • 说明:

      TODO

  • rightLeg

    • 类型: ModelPart
    • 修饰符: protected final
    • 源码定位: L14
    • 说明:

      TODO

  • leftLeg

    • 类型: ModelPart
    • 修饰符: protected final
    • 源码定位: L15
    • 说明:

      TODO

  • body

    • 类型: ModelPart
    • 修饰符: protected final
    • 源码定位: L16
    • 说明:

      TODO

内部类/嵌套类型

构造器

public StriderModel(ModelPart root) @ L18

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

参数:

  • root: ModelPart

说明:

TODO

方法

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

public void setupAnim(StriderRenderState state) @ L25

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

参数:

  • state: StriderRenderState

说明:

TODO

protected abstract void customAnimations(float animationPos, float animationSpeed, float ageInTicks) @ L45

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

参数:

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

说明:

TODO

public void animateBristle(float ageInTicks, float bristleFlow, ModelPart firstBristle, ModelPart secondBristle, ModelPart thirdBristle, BiConsumer<ModelPart,Float> addRotationFunction) @ L47

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

参数:

  • ageInTicks: float
  • bristleFlow: float
  • firstBristle: ModelPart
  • secondBristle: ModelPart
  • thirdBristle: ModelPart
  • addRotationFunction: BiConsumer<ModelPart,Float>

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class StriderModel extends EntityModel<StriderRenderState> {
    protected static final float SPEED = 1.5F;
    protected final ModelPart rightLeg;
    protected final ModelPart leftLeg;
    protected final ModelPart body;
 
    public StriderModel(ModelPart root) {
        super(root);
        this.rightLeg = root.getChild("right_leg");
        this.leftLeg = root.getChild("left_leg");
        this.body = root.getChild("body");
    }
 
    public void setupAnim(StriderRenderState state) {
        super.setupAnim(state);
        float animationPos = state.walkAnimationPos;
        float animationSpeed = Math.min(state.walkAnimationSpeed, 0.25F);
        if (!state.isRidden) {
            this.body.xRot = state.xRot * (float) (Math.PI / 180.0);
            this.body.yRot = state.yRot * (float) (Math.PI / 180.0);
        } else {
            this.body.xRot = 0.0F;
            this.body.yRot = 0.0F;
        }
 
        this.body.zRot = 0.1F * Mth.sin(animationPos * 1.5F) * 4.0F * animationSpeed;
        this.leftLeg.xRot = Mth.sin(animationPos * 1.5F * 0.5F) * 2.0F * animationSpeed;
        this.rightLeg.xRot = Mth.sin(animationPos * 1.5F * 0.5F + (float) Math.PI) * 2.0F * animationSpeed;
        this.leftLeg.zRot = (float) (Math.PI / 18) * Mth.cos(animationPos * 1.5F * 0.5F) * animationSpeed;
        this.rightLeg.zRot = (float) (Math.PI / 18) * Mth.cos(animationPos * 1.5F * 0.5F + (float) Math.PI) * animationSpeed;
        this.customAnimations(animationPos, animationSpeed, state.ageInTicks);
    }
 
    protected abstract void customAnimations(final float animationPos, final float animationSpeed, final float ageInTicks);
 
    public void animateBristle(
        float ageInTicks,
        float bristleFlow,
        ModelPart firstBristle,
        ModelPart secondBristle,
        ModelPart thirdBristle,
        BiConsumer<ModelPart, Float> addRotationFunction
    ) {
        addRotationFunction.accept(firstBristle, bristleFlow * 0.6F);
        addRotationFunction.accept(secondBristle, bristleFlow * 1.2F);
        addRotationFunction.accept(thirdBristle, bristleFlow * 1.3F);
        addRotationFunction.accept(firstBristle, 0.1F * Mth.sin(ageInTicks * 0.4F));
        addRotationFunction.accept(secondBristle, 0.1F * Mth.sin(ageInTicks * 0.2F));
        addRotationFunction.accept(thirdBristle, 0.05F * Mth.sin(ageInTicks * -0.4F));
    }
}

引用的其他类