| 1 | package net.minecraft.client.model.object.boat;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 | import net.minecraft.client.model.geom.ModelPart;
|
| 6 | import net.minecraft.client.model.geom.PartPose;
|
| 7 | import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
| 8 | import net.minecraft.client.model.geom.builders.LayerDefinition;
|
| 9 | import net.minecraft.client.model.geom.builders.MeshDefinition;
|
| 10 | import net.minecraft.client.model.geom.builders.PartDefinition;
|
| 11 |
|
| 12 | @Environment(EnvType.CLIENT)
|
| 13 | public class RaftModel extends AbstractBoatModel {
|
| 14 | public RaftModel(final ModelPart root) {
|
| 15 | super(root);
|
| 16 | }
|
| 17 |
|
| 18 | private static void addCommonParts(final PartDefinition root) {
|
| 19 | root.addOrReplaceChild(
|
| 20 | "bottom",
|
| 21 | CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -11.0F, -4.0F, 28.0F, 20.0F, 4.0F).texOffs(0, 0).addBox(-14.0F, -9.0F, -8.0F, 28.0F, 16.0F, 4.0F),
|
| 22 | PartPose.offsetAndRotation(0.0F, -2.1F, 1.0F, 1.5708F, 0.0F, 0.0F)
|
| 23 | );
|
| 24 | int totalLength = 20;
|
| 25 | int bladeLength = 7;
|
| 26 | int bladeWidth = 6;
|
| 27 | float pivot = -5.0F;
|
| 28 | root.addOrReplaceChild(
|
| 29 | "left_paddle",
|
| 30 | CubeListBuilder.create().texOffs(0, 24).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),
|
| 31 | PartPose.offsetAndRotation(3.0F, -4.0F, 9.0F, 0.0F, 0.0F, (float) (Math.PI / 16))
|
| 32 | );
|
| 33 | root.addOrReplaceChild(
|
| 34 | "right_paddle",
|
| 35 | CubeListBuilder.create().texOffs(40, 24).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),
|
| 36 | PartPose.offsetAndRotation(3.0F, -4.0F, -9.0F, 0.0F, (float) Math.PI, (float) (Math.PI / 16))
|
| 37 | );
|
| 38 | }
|
| 39 |
|
| 40 | public static LayerDefinition createRaftModel() {
|
| 41 | MeshDefinition mesh = new MeshDefinition();
|
| 42 | PartDefinition root = mesh.getRoot();
|
| 43 | addCommonParts(root);
|
| 44 | return LayerDefinition.create(mesh, 128, 64);
|
| 45 | }
|
| 46 |
|
| 47 | public static LayerDefinition createChestRaftModel() {
|
| 48 | MeshDefinition mesh = new MeshDefinition();
|
| 49 | PartDefinition root = mesh.getRoot();
|
| 50 | addCommonParts(root);
|
| 51 | root.addOrReplaceChild(
|
| 52 | "chest_bottom",
|
| 53 | CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 12.0F, 8.0F, 12.0F),
|
| 54 | PartPose.offsetAndRotation(-2.0F, -10.1F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)
|
| 55 | );
|
| 56 | root.addOrReplaceChild(
|
| 57 | "chest_lid",
|
| 58 | CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 12.0F, 4.0F, 12.0F),
|
| 59 | PartPose.offsetAndRotation(-2.0F, -14.1F, -6.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)
|
| 60 | );
|
| 61 | root.addOrReplaceChild(
|
| 62 | "chest_lock",
|
| 63 | CubeListBuilder.create().texOffs(0, 59).addBox(0.0F, 0.0F, 0.0F, 2.0F, 4.0F, 1.0F),
|
| 64 | PartPose.offsetAndRotation(-1.0F, -11.1F, -1.0F, 0.0F, (float) (-Math.PI / 2), 0.0F)
|
| 65 | );
|
| 66 | return LayerDefinition.create(mesh, 128, 128);
|
| 67 | }
|
| 68 | }
|
| 69 |
|