| 1 | package net.minecraft.client.model.object.cart;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 | import net.minecraft.client.model.EntityModel;
|
| 6 | import net.minecraft.client.model.geom.ModelPart;
|
| 7 | import net.minecraft.client.model.geom.PartPose;
|
| 8 | import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
| 9 | import net.minecraft.client.model.geom.builders.LayerDefinition;
|
| 10 | import net.minecraft.client.model.geom.builders.MeshDefinition;
|
| 11 | import net.minecraft.client.model.geom.builders.PartDefinition;
|
| 12 | import net.minecraft.client.renderer.entity.state.MinecartRenderState;
|
| 13 |
|
| 14 | @Environment(EnvType.CLIENT)
|
| 15 | public class MinecartModel extends EntityModel<MinecartRenderState> {
|
| 16 | public MinecartModel(final ModelPart root) {
|
| 17 | super(root);
|
| 18 | }
|
| 19 |
|
| 20 | public static LayerDefinition createBodyLayer() {
|
| 21 | MeshDefinition mesh = new MeshDefinition();
|
| 22 | PartDefinition root = mesh.getRoot();
|
| 23 | int w = 20;
|
| 24 | int d = 8;
|
| 25 | int h = 16;
|
| 26 | int yOff = 4;
|
| 27 | root.addOrReplaceChild(
|
| 28 | "bottom",
|
| 29 | CubeListBuilder.create().texOffs(0, 10).addBox(-10.0F, -8.0F, -1.0F, 20.0F, 16.0F, 2.0F),
|
| 30 | PartPose.offsetAndRotation(0.0F, 4.0F, 0.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
|
| 31 | );
|
| 32 | root.addOrReplaceChild(
|
| 33 | "front",
|
| 34 | CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -9.0F, -1.0F, 16.0F, 8.0F, 2.0F),
|
| 35 | PartPose.offsetAndRotation(-9.0F, 4.0F, 0.0F, 0.0F, (float) (Math.PI * 3.0 / 2.0), 0.0F)
|
| 36 | );
|
| 37 | root.addOrReplaceChild(
|
| 38 | "back",
|
| 39 | CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -9.0F, -1.0F, 16.0F, 8.0F, 2.0F),
|
| 40 | PartPose.offsetAndRotation(9.0F, 4.0F, 0.0F, 0.0F, (float) (Math.PI / 2), 0.0F)
|
| 41 | );
|
| 42 | root.addOrReplaceChild(
|
| 43 | "left",
|
| 44 | CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -9.0F, -1.0F, 16.0F, 8.0F, 2.0F),
|
| 45 | PartPose.offsetAndRotation(0.0F, 4.0F, -7.0F, 0.0F, (float) Math.PI, 0.0F)
|
| 46 | );
|
| 47 | root.addOrReplaceChild("right", CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -9.0F, -1.0F, 16.0F, 8.0F, 2.0F), PartPose.offset(0.0F, 4.0F, 7.0F));
|
| 48 | return LayerDefinition.create(mesh, 64, 32);
|
| 49 | }
|
| 50 | }
|
| 51 |
|