TurtleModel.java

net.minecraft.client.model.animal.turtle.TurtleModel

信息

  • 全限定名:net.minecraft.client.model.animal.turtle.TurtleModel
  • 类型:public abstract class
  • 包:net.minecraft.client.model.animal.turtle
  • 源码路径:src/main/java/net/minecraft/client/model/animal/turtle/TurtleModel.java
  • 起始行号:L14
  • 继承:QuadrupedModel
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public TurtleModel(ModelPart root, Function<Identifier,RenderType> renderType) @ L15

  • 构造器名:TurtleModel
  • 源码定位:L15
  • 修饰符:public

参数:

  • root: ModelPart
  • renderType: Function<Identifier,RenderType>

说明:

TODO

方法

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

public void setupAnim(TurtleRenderState state) @ L19

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

参数:

  • state: TurtleRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class TurtleModel extends QuadrupedModel<TurtleRenderState> {
    public TurtleModel(ModelPart root, Function<Identifier, RenderType> renderType) {
        super(root, renderType);
    }
 
    public void setupAnim(TurtleRenderState state) {
        super.setupAnim(state);
        float animationPos = state.walkAnimationPos;
        float animationSpeed = state.walkAnimationSpeed;
        if (state.isOnLand) {
            float layEgg = state.isLayingEgg ? 4.0F : 1.0F;
            float layEggAmplitude = state.isLayingEgg ? 2.0F : 1.0F;
            float swingPos = animationPos * 5.0F;
            float frontSwing = Mth.cos(layEgg * swingPos);
            float hindSwing = Mth.cos(swingPos);
            this.rightFrontLeg.yRot = -frontSwing * 8.0F * animationSpeed * layEggAmplitude;
            this.leftFrontLeg.yRot = frontSwing * 8.0F * animationSpeed * layEggAmplitude;
            this.rightHindLeg.yRot = -hindSwing * 3.0F * animationSpeed;
            this.leftHindLeg.yRot = hindSwing * 3.0F * animationSpeed;
        } else {
            float swingScale = 0.5F * animationSpeed;
            float swing = Mth.cos(animationPos * 0.6662F * 0.6F) * swingScale;
            this.rightHindLeg.xRot = swing;
            this.leftHindLeg.xRot = -swing;
            this.rightFrontLeg.zRot = -swing;
            this.leftFrontLeg.zRot = swing;
        }
    }
}

引用的其他类