| 1 | package net.minecraft.client.model.animal.goat;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 | import net.minecraft.client.model.QuadrupedModel;
|
| 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.GoatRenderState;
|
| 13 |
|
| 14 | @Environment(EnvType.CLIENT)
|
| 15 | public class GoatModel extends QuadrupedModel<GoatRenderState> {
|
| 16 | public GoatModel(final ModelPart root) {
|
| 17 | super(root);
|
| 18 | }
|
| 19 |
|
| 20 | public static LayerDefinition createBodyLayer() {
|
| 21 | MeshDefinition mesh = new MeshDefinition();
|
| 22 | PartDefinition root = mesh.getRoot();
|
| 23 | PartDefinition head = root.addOrReplaceChild(
|
| 24 | "head",
|
| 25 | CubeListBuilder.create()
|
| 26 | .texOffs(2, 61)
|
| 27 | .addBox("right ear", -6.0F, -11.0F, -10.0F, 3.0F, 2.0F, 1.0F)
|
| 28 | .texOffs(2, 61)
|
| 29 | .mirror()
|
| 30 | .addBox("left ear", 2.0F, -11.0F, -10.0F, 3.0F, 2.0F, 1.0F)
|
| 31 | .texOffs(23, 52)
|
| 32 | .addBox("goatee", -0.5F, -3.0F, -14.0F, 0.0F, 7.0F, 5.0F),
|
| 33 | PartPose.offset(1.0F, 14.0F, 0.0F)
|
| 34 | );
|
| 35 | head.addOrReplaceChild(
|
| 36 | "left_horn", CubeListBuilder.create().texOffs(12, 55).addBox(-0.01F, -16.0F, -10.0F, 2.0F, 7.0F, 2.0F), PartPose.offset(0.0F, 0.0F, 0.0F)
|
| 37 | );
|
| 38 | head.addOrReplaceChild(
|
| 39 | "right_horn", CubeListBuilder.create().texOffs(12, 55).addBox(-2.99F, -16.0F, -10.0F, 2.0F, 7.0F, 2.0F), PartPose.offset(0.0F, 0.0F, 0.0F)
|
| 40 | );
|
| 41 | head.addOrReplaceChild(
|
| 42 | "nose",
|
| 43 | CubeListBuilder.create().texOffs(34, 46).addBox(-3.0F, -4.0F, -8.0F, 5.0F, 7.0F, 10.0F),
|
| 44 | PartPose.offsetAndRotation(0.0F, -8.0F, -8.0F, 0.9599F, 0.0F, 0.0F)
|
| 45 | );
|
| 46 | root.addOrReplaceChild(
|
| 47 | "body",
|
| 48 | CubeListBuilder.create().texOffs(1, 1).addBox(-4.0F, -17.0F, -7.0F, 9.0F, 11.0F, 16.0F).texOffs(0, 28).addBox(-5.0F, -18.0F, -8.0F, 11.0F, 14.0F, 11.0F),
|
| 49 | PartPose.offset(0.0F, 24.0F, 0.0F)
|
| 50 | );
|
| 51 | root.addOrReplaceChild(
|
| 52 | "left_hind_leg", CubeListBuilder.create().texOffs(36, 29).addBox(0.0F, 4.0F, 0.0F, 3.0F, 6.0F, 3.0F), PartPose.offset(1.0F, 14.0F, 4.0F)
|
| 53 | );
|
| 54 | root.addOrReplaceChild(
|
| 55 | "right_hind_leg", CubeListBuilder.create().texOffs(49, 29).addBox(0.0F, 4.0F, 0.0F, 3.0F, 6.0F, 3.0F), PartPose.offset(-3.0F, 14.0F, 4.0F)
|
| 56 | );
|
| 57 | root.addOrReplaceChild(
|
| 58 | "left_front_leg", CubeListBuilder.create().texOffs(49, 2).addBox(0.0F, 0.0F, 0.0F, 3.0F, 10.0F, 3.0F), PartPose.offset(1.0F, 14.0F, -6.0F)
|
| 59 | );
|
| 60 | root.addOrReplaceChild(
|
| 61 | "right_front_leg", CubeListBuilder.create().texOffs(35, 2).addBox(0.0F, 0.0F, 0.0F, 3.0F, 10.0F, 3.0F), PartPose.offset(-3.0F, 14.0F, -6.0F)
|
| 62 | );
|
| 63 | return LayerDefinition.create(mesh, 64, 64);
|
| 64 | }
|
| 65 |
|
| 66 | public void setupAnim(final GoatRenderState state) {
|
| 67 | super.setupAnim(state);
|
| 68 | this.head.getChild("left_horn").visible = state.hasLeftHorn;
|
| 69 | this.head.getChild("right_horn").visible = state.hasRightHorn;
|
| 70 | if (state.rammingXHeadRot != 0.0F) {
|
| 71 | this.head.xRot = state.rammingXHeadRot;
|
| 72 | }
|
| 73 | }
|
| 74 | }
|
| 75 |
|