AdultTurtleModel.java

net.minecraft.client.model.animal.turtle.AdultTurtleModel

信息

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

    TODO

字段/常量

  • EGG_BELLY

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

      TODO

  • eggBelly

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

      TODO

内部类/嵌套类型

构造器

public AdultTurtleModel(ModelPart root) @ L19

  • 构造器名:AdultTurtleModel
  • 源码定位:L19
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public void setupAnim(TurtleRenderState state) @ L24

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

参数:

  • state: TurtleRenderState

说明:

TODO

public static LayerDefinition createBodyLayer() @ L33

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class AdultTurtleModel extends TurtleModel {
    private static final String EGG_BELLY = "egg_belly";
    private final ModelPart eggBelly;
 
    public AdultTurtleModel(ModelPart root) {
        super(root, RenderTypes::entityCutout);
        this.eggBelly = root.getChild("egg_belly");
    }
 
    @Override
    public void setupAnim(TurtleRenderState state) {
        super.setupAnim(state);
        this.eggBelly.visible = state.hasEgg;
        if (this.eggBelly.visible) {
            this.root.y--;
        }
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild(
            "head", CubeListBuilder.create().texOffs(3, 0).addBox(-3.0F, -1.0F, -3.0F, 6.0F, 5.0F, 6.0F), PartPose.offset(0.0F, 19.0F, -10.0F)
        );
        root.addOrReplaceChild(
            "body",
            CubeListBuilder.create()
                .texOffs(7, 37)
                .addBox("shell", -9.5F, 3.0F, -10.0F, 19.0F, 20.0F, 6.0F)
                .texOffs(31, 1)
                .addBox("belly", -5.5F, 3.0F, -13.0F, 11.0F, 18.0F, 3.0F),
            PartPose.offsetAndRotation(0.0F, 11.0F, -10.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "egg_belly",
            CubeListBuilder.create().texOffs(70, 33).addBox(-4.5F, 3.0F, -14.0F, 9.0F, 18.0F, 1.0F),
            PartPose.offsetAndRotation(0.0F, 11.0F, -10.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        int legHeight = 1;
        root.addOrReplaceChild(
            "right_hind_leg", CubeListBuilder.create().texOffs(1, 23).addBox(-2.0F, 0.0F, 0.0F, 4.0F, 1.0F, 10.0F), PartPose.offset(-3.5F, 22.0F, 11.0F)
        );
        root.addOrReplaceChild(
            "left_hind_leg", CubeListBuilder.create().texOffs(1, 12).addBox(-2.0F, 0.0F, 0.0F, 4.0F, 1.0F, 10.0F), PartPose.offset(3.5F, 22.0F, 11.0F)
        );
        root.addOrReplaceChild(
            "right_front_leg", CubeListBuilder.create().texOffs(27, 30).addBox(-13.0F, 0.0F, -2.0F, 13.0F, 1.0F, 5.0F), PartPose.offset(-5.0F, 21.0F, -4.0F)
        );
        root.addOrReplaceChild(
            "left_front_leg", CubeListBuilder.create().texOffs(27, 24).addBox(0.0F, 0.0F, -2.0F, 13.0F, 1.0F, 5.0F), PartPose.offset(5.0F, 21.0F, -4.0F)
        );
        return LayerDefinition.create(mesh, 128, 64);
    }
}

引用的其他类

  • TurtleModel

    • 引用位置: 继承
  • ModelPart

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

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

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

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

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

    • 引用位置: 参数