BoatModel.java

net.minecraft.client.model.object.boat.BoatModel

信息

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

    TODO

字段/常量

  • BOTTOM_WIDTH

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

      TODO

  • WIDTH

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

      TODO

  • DEPTH

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

      TODO

  • LENGTH

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

      TODO

  • Y_OFFSET

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

      TODO

  • WATER_PATCH

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

      TODO

  • BACK

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

      TODO

  • FRONT

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

      TODO

  • RIGHT

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

      TODO

  • LEFT

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

      TODO

内部类/嵌套类型

构造器

public BoatModel(ModelPart root) @ L25

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

参数:

  • root: ModelPart

说明:

TODO

方法

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

private static void addCommonParts(PartDefinition root) @ L29

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

参数:

  • root: PartDefinition

说明:

TODO

public static LayerDefinition createBoatModel() @ L72

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

参数:

说明:

TODO

public static LayerDefinition createChestBoatModel() @ L79

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

参数:

说明:

TODO

public static LayerDefinition createWaterPatch() @ L101

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class BoatModel extends AbstractBoatModel {
    private static final int BOTTOM_WIDTH = 28;
    private static final int WIDTH = 32;
    private static final int DEPTH = 6;
    private static final int LENGTH = 20;
    private static final int Y_OFFSET = 4;
    private static final String WATER_PATCH = "water_patch";
    private static final String BACK = "back";
    private static final String FRONT = "front";
    private static final String RIGHT = "right";
    private static final String LEFT = "left";
 
    public BoatModel(ModelPart root) {
        super(root);
    }
 
    private static void addCommonParts(PartDefinition root) {
        int halfWidth = 16;
        int halfBottomWidth = 14;
        int halfLength = 10;
        root.addOrReplaceChild(
            "bottom",
            CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -9.0F, -3.0F, 28.0F, 16.0F, 3.0F),
            PartPose.offsetAndRotation(0.0F, 3.0F, 1.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "back",
            CubeListBuilder.create().texOffs(0, 19).addBox(-13.0F, -7.0F, -1.0F, 18.0F, 6.0F, 2.0F),
            PartPose.offsetAndRotation(-15.0F, 4.0F, 4.0F, 0.0F, (float) (Math.PI * 3.0 / 2.0), 0.0F)
        );
        root.addOrReplaceChild(
            "front",
            CubeListBuilder.create().texOffs(0, 27).addBox(-8.0F, -7.0F, -1.0F, 16.0F, 6.0F, 2.0F),
            PartPose.offsetAndRotation(15.0F, 4.0F, 0.0F, 0.0F, (float) (Math.PI / 2), 0.0F)
        );
        root.addOrReplaceChild(
            "right",
            CubeListBuilder.create().texOffs(0, 35).addBox(-14.0F, -7.0F, -1.0F, 28.0F, 6.0F, 2.0F),
            PartPose.offsetAndRotation(0.0F, 4.0F, -9.0F, 0.0F, (float) Math.PI, 0.0F)
        );
        root.addOrReplaceChild(
            "left", CubeListBuilder.create().texOffs(0, 43).addBox(-14.0F, -7.0F, -1.0F, 28.0F, 6.0F, 2.0F), PartPose.offset(0.0F, 4.0F, 9.0F)
        );
        int totalLength = 20;
        int bladeLength = 7;
        int bladeWidth = 6;
        float pivot = -5.0F;
        root.addOrReplaceChild(
            "left_paddle",
            CubeListBuilder.create().texOffs(62, 0).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(-1.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F),
            PartPose.offsetAndRotation(3.0F, -5.0F, 9.0F, 0.0F, 0.0F, (float) (Math.PI / 16))
        );
        root.addOrReplaceChild(
            "right_paddle",
            CubeListBuilder.create().texOffs(62, 20).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(0.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F),
            PartPose.offsetAndRotation(3.0F, -5.0F, -9.0F, 0.0F, (float) Math.PI, (float) (Math.PI / 16))
        );
    }
 
    public static LayerDefinition createBoatModel() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        addCommonParts(root);
        return LayerDefinition.create(mesh, 128, 64);
    }
 
    public static LayerDefinition createChestBoatModel() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        addCommonParts(root);
        root.addOrReplaceChild(
            "chest_bottom",
            CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 12.0F, 8.0F, 12.0F),
            PartPose.offsetAndRotation(-2.0F, -5.0F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)
        );
        root.addOrReplaceChild(
            "chest_lid",
            CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 12.0F, 4.0F, 12.0F),
            PartPose.offsetAndRotation(-2.0F, -9.0F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)
        );
        root.addOrReplaceChild(
            "chest_lock",
            CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 2.0F, 4.0F, 1.0F),
            PartPose.offsetAndRotation(-1.0F, -6.0F, -1.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)
        );
        return LayerDefinition.create(mesh, 128, 128);
    }
 
    public static LayerDefinition createWaterPatch() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        root.addOrReplaceChild(
            "water_patch",
            CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -9.0F, -3.0F, 28.0F, 16.0F, 3.0F),
            PartPose.offsetAndRotation(0.0F, -3.0F, 1.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
        );
        return LayerDefinition.create(mesh, 0, 0);
    }
}

引用的其他类