ChestModel.java

net.minecraft.client.model.object.chest.ChestModel

信息

  • 全限定名:net.minecraft.client.model.object.chest.ChestModel
  • 类型:public class
  • 包:net.minecraft.client.model.object.chest
  • 源码路径:src/main/java/net/minecraft/client/model/object/chest/ChestModel.java
  • 起始行号:L18
  • 继承:Model
  • 职责:

    TODO

字段/常量

  • BOTTOM

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

      TODO

  • LID

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

      TODO

  • LOCK

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

      TODO

  • lid

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

      TODO

  • lock

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

      TODO

内部类/嵌套类型

构造器

public ChestModel(ModelPart root) @ L25

  • 构造器名:ChestModel
  • 源码定位:L25
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createSingleBodyLayer() @ L31

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

参数:

说明:

TODO

public static LayerDefinition createDoubleBodyRightLayer() @ L40

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

参数:

说明:

TODO

public static LayerDefinition createDoubleBodyLeftLayer() @ L54

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

参数:

说明:

TODO

public void setupAnim(Float open) @ L68

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

参数:

  • open: Float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ChestModel extends Model<Float> {
    private static final String BOTTOM = "bottom";
    private static final String LID = "lid";
    private static final String LOCK = "lock";
    private final ModelPart lid;
    private final ModelPart lock;
 
    public ChestModel(ModelPart root) {
        super(root, RenderTypes::entityCutoutCull);
        this.lid = root.getChild("lid");
        this.lock = root.getChild("lock");
    }
 
    public static LayerDefinition createSingleBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(1.0F, 0.0F, 1.0F, 14.0F, 10.0F, 14.0F), PartPose.ZERO);
        root.addOrReplaceChild("lid", CubeListBuilder.create().texOffs(0, 0).addBox(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F), PartPose.offset(0.0F, 9.0F, 1.0F));
        root.addOrReplaceChild("lock", CubeListBuilder.create().texOffs(0, 0).addBox(7.0F, -2.0F, 14.0F, 2.0F, 4.0F, 1.0F), PartPose.offset(0.0F, 9.0F, 1.0F));
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public static LayerDefinition createDoubleBodyRightLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        Set<Direction> visibleFaces = Util.allOfEnumExcept(Direction.EAST);
        root.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(1.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F, visibleFaces), PartPose.ZERO);
        root.addOrReplaceChild(
            "lid", CubeListBuilder.create().texOffs(0, 0).addBox(1.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F, visibleFaces), PartPose.offset(0.0F, 9.0F, 1.0F)
        );
        root.addOrReplaceChild(
            "lock", CubeListBuilder.create().texOffs(0, 0).addBox(15.0F, -2.0F, 14.0F, 1.0F, 4.0F, 1.0F, visibleFaces), PartPose.offset(0.0F, 9.0F, 1.0F)
        );
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public static LayerDefinition createDoubleBodyLeftLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        Set<Direction> visibleFaces = Util.allOfEnumExcept(Direction.WEST);
        root.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 19).addBox(0.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F, visibleFaces), PartPose.ZERO);
        root.addOrReplaceChild(
            "lid", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F, visibleFaces), PartPose.offset(0.0F, 9.0F, 1.0F)
        );
        root.addOrReplaceChild(
            "lock", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -2.0F, 14.0F, 1.0F, 4.0F, 1.0F, visibleFaces), PartPose.offset(0.0F, 9.0F, 1.0F)
        );
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public void setupAnim(Float open) {
        super.setupAnim(open);
        this.lid.xRot = -(open * (float) (Math.PI / 2));
        this.lock.xRot = this.lid.xRot;
    }
}

引用的其他类

  • Model

    • 引用位置: 继承
  • ModelPart

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

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

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

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

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

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