WitherBossModel.java

net.minecraft.client.model.monster.wither.WitherBossModel

信息

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

    TODO

字段/常量

  • RIBCAGE

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

      TODO

  • CENTER_HEAD

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

      TODO

  • RIGHT_HEAD

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

      TODO

  • LEFT_HEAD

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

      TODO

  • RIBCAGE_X_ROT_OFFSET

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

      TODO

  • TAIL_X_ROT_OFFSET

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

      TODO

  • centerHead

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

      TODO

  • rightHead

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

      TODO

  • leftHead

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

      TODO

  • ribcage

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

      TODO

  • tail

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

      TODO

内部类/嵌套类型

构造器

public WitherBossModel(ModelPart root) @ L30

  • 构造器名:WitherBossModel
  • 源码定位:L30
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer(CubeDeformation g) @ L39

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

参数:

  • g: CubeDeformation

说明:

TODO

public void setupAnim(WitherRenderState state) @ L69

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

参数:

  • state: WitherRenderState

说明:

TODO

private static void setupHeadRotation(WitherRenderState state, ModelPart head, int headIndex) @ L81

  • 方法名:setupHeadRotation
  • 源码定位:L81
  • 返回类型:void
  • 修饰符:private static

参数:

  • state: WitherRenderState
  • head: ModelPart
  • headIndex: int

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class WitherBossModel extends EntityModel<WitherRenderState> {
    private static final String RIBCAGE = "ribcage";
    private static final String CENTER_HEAD = "center_head";
    private static final String RIGHT_HEAD = "right_head";
    private static final String LEFT_HEAD = "left_head";
    private static final float RIBCAGE_X_ROT_OFFSET = 0.065F;
    private static final float TAIL_X_ROT_OFFSET = 0.265F;
    private final ModelPart centerHead;
    private final ModelPart rightHead;
    private final ModelPart leftHead;
    private final ModelPart ribcage;
    private final ModelPart tail;
 
    public WitherBossModel(ModelPart root) {
        super(root);
        this.ribcage = root.getChild("ribcage");
        this.tail = root.getChild("tail");
        this.centerHead = root.getChild("center_head");
        this.rightHead = root.getChild("right_head");
        this.leftHead = root.getChild("left_head");
    }
 
    public static LayerDefinition createBodyLayer(CubeDeformation g) {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild("shoulders", CubeListBuilder.create().texOffs(0, 16).addBox(-10.0F, 3.9F, -0.5F, 20.0F, 3.0F, 3.0F, g), PartPose.ZERO);
        float ribcageXRot = 0.20420352F;
        root.addOrReplaceChild(
            "ribcage",
            CubeListBuilder.create()
                .texOffs(0, 22)
                .addBox(0.0F, 0.0F, 0.0F, 3.0F, 10.0F, 3.0F, g)
                .texOffs(24, 22)
                .addBox(-4.0F, 1.5F, 0.5F, 11.0F, 2.0F, 2.0F, g)
                .texOffs(24, 22)
                .addBox(-4.0F, 4.0F, 0.5F, 11.0F, 2.0F, 2.0F, g)
                .texOffs(24, 22)
                .addBox(-4.0F, 6.5F, 0.5F, 11.0F, 2.0F, 2.0F, g),
            PartPose.offsetAndRotation(-2.0F, 6.9F, -0.5F, 0.20420352F, 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "tail",
            CubeListBuilder.create().texOffs(12, 22).addBox(0.0F, 0.0F, 0.0F, 3.0F, 6.0F, 3.0F, g),
            PartPose.offsetAndRotation(-2.0F, 6.9F + Mth.cos(0.20420352F) * 10.0F, -0.5F + Mth.sin(0.20420352F) * 10.0F, 0.83252203F, 0.0F, 0.0F)
        );
        root.addOrReplaceChild("center_head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F, g), PartPose.ZERO);
        CubeListBuilder sideHead = CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -4.0F, -4.0F, 6.0F, 6.0F, 6.0F, g);
        root.addOrReplaceChild("right_head", sideHead, PartPose.offset(-8.0F, 4.0F, 0.0F));
        root.addOrReplaceChild("left_head", sideHead, PartPose.offset(10.0F, 4.0F, 0.0F));
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public void setupAnim(WitherRenderState state) {
        super.setupAnim(state);
        setupHeadRotation(state, this.rightHead, 0);
        setupHeadRotation(state, this.leftHead, 1);
        float anim = Mth.cos(state.ageInTicks * 0.1F);
        this.ribcage.xRot = (0.065F + 0.05F * anim) * (float) Math.PI;
        this.tail.setPos(-2.0F, 6.9F + Mth.cos(this.ribcage.xRot) * 10.0F, -0.5F + Mth.sin(this.ribcage.xRot) * 10.0F);
        this.tail.xRot = (0.265F + 0.1F * anim) * (float) Math.PI;
        this.centerHead.yRot = state.yRot * (float) (Math.PI / 180.0);
        this.centerHead.xRot = state.xRot * (float) (Math.PI / 180.0);
    }
 
    private static void setupHeadRotation(WitherRenderState state, ModelPart head, int headIndex) {
        head.yRot = (state.yHeadRots[headIndex] - state.bodyRot) * (float) (Math.PI / 180.0);
        head.xRot = state.xHeadRots[headIndex] * (float) (Math.PI / 180.0);
    }
}

引用的其他类

  • EntityModel

    • 引用位置: 继承
  • ModelPart

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

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

    • 引用位置: 参数
  • CubeListBuilder

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

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

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

    • 引用位置: 参数
  • Mth

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