AdultFoxModel.java

net.minecraft.client.model.animal.fox.AdultFoxModel

信息

  • 全限定名:net.minecraft.client.model.animal.fox.AdultFoxModel
  • 类型:public class
  • 包:net.minecraft.client.model.animal.fox
  • 源码路径:src/main/java/net/minecraft/client/model/animal/fox/AdultFoxModel.java
  • 起始行号:L16
  • 继承:FoxModel
  • 职责:

    TODO

字段/常量

  • LEG_SIZE

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

      TODO

  • HEAD_HEIGHT

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

      TODO

  • LEG_POS

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

      TODO

内部类/嵌套类型

构造器

public AdultFoxModel(ModelPart root) @ L21

  • 构造器名:AdultFoxModel
  • 源码定位:L21
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer() @ L25

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

参数:

说明:

TODO

protected void setSittingPose(FoxRenderState state) @ L54

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

参数:

  • state: FoxRenderState

说明:

TODO

protected void setSleepingPose(FoxRenderState state) @ L74

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

参数:

  • state: FoxRenderState

说明:

TODO

protected void setWalkingPose(FoxRenderState state) @ L86

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

参数:

  • state: FoxRenderState

说明:

TODO

protected void setCrouchingPose(FoxRenderState state) @ L97

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

参数:

  • state: FoxRenderState

说明:

TODO

protected void setPouncingPose(FoxRenderState state) @ L103

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

参数:

  • state: FoxRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class AdultFoxModel extends FoxModel {
    private static final int LEG_SIZE = 6;
    private static final float HEAD_HEIGHT = 16.5F;
    private static final float LEG_POS = 17.5F;
 
    public AdultFoxModel(ModelPart root) {
        super(root);
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        PartDefinition head = root.addOrReplaceChild(
            "head", CubeListBuilder.create().texOffs(1, 5).addBox(-3.0F, -2.0F, -5.0F, 8.0F, 6.0F, 6.0F), PartPose.offset(-1.0F, 16.5F, -3.0F)
        );
        head.addOrReplaceChild("right_ear", CubeListBuilder.create().texOffs(8, 1).addBox(-3.0F, -4.0F, -4.0F, 2.0F, 2.0F, 1.0F), PartPose.ZERO);
        head.addOrReplaceChild("left_ear", CubeListBuilder.create().texOffs(15, 1).addBox(3.0F, -4.0F, -4.0F, 2.0F, 2.0F, 1.0F), PartPose.ZERO);
        head.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(6, 18).addBox(-1.0F, 2.01F, -8.0F, 4.0F, 2.0F, 3.0F), PartPose.ZERO);
        PartDefinition body = root.addOrReplaceChild(
            "body",
            CubeListBuilder.create().texOffs(24, 15).addBox(-3.0F, 3.999F, -3.5F, 6.0F, 11.0F, 6.0F),
            PartPose.offsetAndRotation(0.0F, 16.0F, -6.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        CubeDeformation fudge = new CubeDeformation(0.001F);
        CubeListBuilder leftLeg = CubeListBuilder.create().texOffs(4, 24).addBox(2.0F, 0.5F, -1.0F, 2.0F, 6.0F, 2.0F, fudge);
        CubeListBuilder rightLeg = CubeListBuilder.create().texOffs(13, 24).addBox(2.0F, 0.5F, -1.0F, 2.0F, 6.0F, 2.0F, fudge);
        root.addOrReplaceChild("right_hind_leg", rightLeg, PartPose.offset(-5.0F, 17.5F, 7.0F));
        root.addOrReplaceChild("left_hind_leg", leftLeg, PartPose.offset(-1.0F, 17.5F, 7.0F));
        root.addOrReplaceChild("right_front_leg", rightLeg, PartPose.offset(-5.0F, 17.5F, 0.0F));
        root.addOrReplaceChild("left_front_leg", leftLeg, PartPose.offset(-1.0F, 17.5F, 0.0F));
        body.addOrReplaceChild(
            "tail",
            CubeListBuilder.create().texOffs(30, 0).addBox(2.0F, 0.0F, -1.0F, 4.0F, 9.0F, 5.0F),
            PartPose.offsetAndRotation(-4.0F, 15.0F, -1.0F, -0.05235988F, 0.0F, 0.0F)
        );
        return LayerDefinition.create(mesh, 48, 32);
    }
 
    @Override
    protected void setSittingPose(FoxRenderState state) {
        super.setSittingPose(state);
        this.body.xRot = (float) (Math.PI / 6);
        this.body.y -= 7.0F;
        this.body.z += 3.0F;
        this.tail.xRot = (float) (Math.PI / 4);
        this.head.y -= 6.5F;
        this.head.z += 2.75F;
        this.rightFrontLeg.xRot = (float) (-Math.PI / 12);
        this.leftFrontLeg.xRot = (float) (-Math.PI / 12);
        this.rightHindLeg.xRot = (float) (-Math.PI * 5.0 / 12.0);
        this.rightHindLeg.y += 4.0F;
        this.rightHindLeg.z -= 0.25F;
        this.leftHindLeg.xRot = (float) (-Math.PI * 5.0 / 12.0);
        this.leftHindLeg.y += 4.0F;
        this.leftHindLeg.z -= 0.25F;
        this.tail.z--;
    }
 
    @Override
    protected void setSleepingPose(FoxRenderState state) {
        super.setSleepingPose(state);
        this.body.zRot = (float) (-Math.PI / 2);
        this.body.y += 5.0F;
        this.tail.xRot = (float) (-Math.PI * 5.0 / 6.0);
        this.head.x += 2.0F;
        this.head.y += 2.99F;
        this.head.yRot = (float) (-Math.PI * 2.0 / 3.0);
        this.head.zRot = 0.0F;
    }
 
    @Override
    protected void setWalkingPose(FoxRenderState state) {
        super.setWalkingPose(state);
        float animationSpeed = state.walkAnimationSpeed;
        float animationPos = state.walkAnimationPos;
        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;
    }
 
    @Override
    protected void setCrouchingPose(FoxRenderState state) {
        super.setCrouchingPose(state);
        this.body.y = this.body.y + state.crouchAmount;
    }
 
    @Override
    protected void setPouncingPose(FoxRenderState state) {
        super.setPouncingPose(state);
        float crouch = state.crouchAmount / 2.0F;
        this.body.y -= crouch;
        this.head.y -= crouch;
    }
}

引用的其他类

  • FoxModel

    • 引用位置: 继承
  • ModelPart

    • 引用位置: 参数
  • PartPose

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

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

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

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

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

    • 引用位置: 参数
  • Mth

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