WolfModel.java

net.minecraft.client.model.animal.wolf.WolfModel

信息

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

    TODO

字段/常量

  • head

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

      TODO

  • body

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

      TODO

  • rightHindLeg

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

      TODO

  • leftHindLeg

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

      TODO

  • rightFrontLeg

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

      TODO

  • leftFrontLeg

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

      TODO

  • tail

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

      TODO

内部类/嵌套类型

构造器

public WolfModel(ModelPart root) @ L20

  • 构造器名:WolfModel
  • 源码定位:L20
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public void setupAnim(WolfRenderState state) @ L31

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

参数:

  • state: WolfRenderState

说明:

TODO

protected void shakeOffWater(WolfRenderState state) @ L56

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

参数:

  • state: WolfRenderState

说明:

TODO

protected void setSittingPose(WolfRenderState state) @ L60

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

参数:

  • state: WolfRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class WolfModel extends EntityModel<WolfRenderState> {
    protected final ModelPart head;
    protected final ModelPart body;
    protected final ModelPart rightHindLeg;
    protected final ModelPart leftHindLeg;
    protected final ModelPart rightFrontLeg;
    protected final ModelPart leftFrontLeg;
    protected final ModelPart tail;
 
    public WolfModel(ModelPart root) {
        super(root);
        this.head = root.getChild("head");
        this.body = root.getChild("body");
        this.rightHindLeg = root.getChild("right_hind_leg");
        this.leftHindLeg = root.getChild("left_hind_leg");
        this.rightFrontLeg = root.getChild("right_front_leg");
        this.leftFrontLeg = root.getChild("left_front_leg");
        this.tail = root.getChild("tail");
    }
 
    public void setupAnim(WolfRenderState state) {
        super.setupAnim(state);
        float animationPos = state.walkAnimationPos;
        float animationSpeed = state.walkAnimationSpeed;
        if (state.isAngry) {
            this.tail.yRot = 0.0F;
        } else {
            this.tail.yRot = Mth.cos(animationPos * 0.6662F) * 1.4F * animationSpeed;
        }
 
        if (state.isSitting) {
            this.setSittingPose(state);
        } else {
            this.rightHindLeg.xRot = Mth.cos(animationPos * 0.6662F) * 1.4F * animationSpeed;
            this.leftHindLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * 1.4F * animationSpeed;
            this.rightFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * 1.4F * animationSpeed;
            this.leftFrontLeg.xRot = Mth.cos(animationPos * 0.6662F) * 1.4F * animationSpeed;
        }
 
        this.shakeOffWater(state);
        this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
        this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
        this.tail.xRot = state.tailAngle;
    }
 
    protected void shakeOffWater(WolfRenderState state) {
        this.body.zRot = state.getBodyRollAngle(-0.16F);
    }
 
    protected void setSittingPose(WolfRenderState state) {
        float ageScale = state.ageScale;
        this.body.y += 4.0F * ageScale;
        this.body.z -= 2.0F * ageScale;
        this.body.xRot = (float) (Math.PI / 4);
        this.tail.y += 9.0F * ageScale;
        this.tail.z -= 2.0F * ageScale;
        this.rightHindLeg.y += 6.7F * ageScale;
        this.rightHindLeg.z -= 5.0F * ageScale;
        this.rightHindLeg.xRot = (float) (Math.PI * 3.0 / 2.0);
        this.leftHindLeg.y += 6.7F * ageScale;
        this.leftHindLeg.z -= 5.0F * ageScale;
        this.leftHindLeg.xRot = (float) (Math.PI * 3.0 / 2.0);
        this.rightFrontLeg.xRot = 5.811947F;
        this.rightFrontLeg.x += 0.01F * ageScale;
        this.rightFrontLeg.y += 1.0F * ageScale;
        this.leftFrontLeg.xRot = 5.811947F;
        this.leftFrontLeg.x -= 0.01F * ageScale;
        this.leftFrontLeg.y += 1.0F * ageScale;
    }
}

引用的其他类