| 1 | package net.minecraft.client.model.animal.wolf;
|
| 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.CubeDeformation;
|
| 8 | import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
| 9 | import net.minecraft.client.model.geom.builders.MeshDefinition;
|
| 10 | import net.minecraft.client.model.geom.builders.PartDefinition;
|
| 11 | import net.minecraft.client.renderer.entity.state.WolfRenderState;
|
| 12 |
|
| 13 | @Environment(EnvType.CLIENT)
|
| 14 | public class AdultWolfModel extends WolfModel {
|
| 15 | private static final String REAL_HEAD = "real_head";
|
| 16 | private static final String UPPER_BODY = "upper_body";
|
| 17 | private static final String REAL_TAIL = "real_tail";
|
| 18 | private final ModelPart realHead = this.head.getChild("real_head");
|
| 19 | private final ModelPart realTail;
|
| 20 | private final ModelPart upperBody;
|
| 21 | private static final int LEG_SIZE = 8;
|
| 22 |
|
| 23 | public AdultWolfModel(final ModelPart root) {
|
| 24 | super(root);
|
| 25 | this.upperBody = root.getChild("upper_body");
|
| 26 | this.realTail = this.tail.getChild("real_tail");
|
| 27 | }
|
| 28 |
|
| 29 | public static MeshDefinition createBodyLayer(final CubeDeformation g) {
|
| 30 | MeshDefinition mesh = new MeshDefinition();
|
| 31 | PartDefinition root = mesh.getRoot();
|
| 32 | float headHeight = 13.5F;
|
| 33 | PartDefinition head = root.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.offset(-1.0F, 13.5F, -7.0F));
|
| 34 | head.addOrReplaceChild(
|
| 35 | "real_head",
|
| 36 | CubeListBuilder.create()
|
| 37 | .texOffs(0, 0)
|
| 38 | .addBox(-2.0F, -3.0F, -2.0F, 6.0F, 6.0F, 4.0F, g)
|
| 39 | .texOffs(16, 14)
|
| 40 | .addBox(-2.0F, -5.0F, 0.0F, 2.0F, 2.0F, 1.0F, g)
|
| 41 | .texOffs(16, 14)
|
| 42 | .addBox(2.0F, -5.0F, 0.0F, 2.0F, 2.0F, 1.0F, g)
|
| 43 | .texOffs(0, 10)
|
| 44 | .addBox(-0.5F, -0.001F, -5.0F, 3.0F, 3.0F, 4.0F, g),
|
| 45 | PartPose.ZERO
|
| 46 | );
|
| 47 | root.addOrReplaceChild(
|
| 48 | "body",
|
| 49 | CubeListBuilder.create().texOffs(18, 14).addBox(-3.0F, -2.0F, -3.0F, 6.0F, 9.0F, 6.0F, g),
|
| 50 | PartPose.offsetAndRotation(0.0F, 14.0F, 2.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
|
| 51 | );
|
| 52 | root.addOrReplaceChild(
|
| 53 | "upper_body",
|
| 54 | CubeListBuilder.create().texOffs(21, 0).addBox(-3.0F, -3.0F, -3.0F, 8.0F, 6.0F, 7.0F, g),
|
| 55 | PartPose.offsetAndRotation(-1.0F, 14.0F, -3.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
|
| 56 | );
|
| 57 | CubeListBuilder leftLeg = CubeListBuilder.create().texOffs(0, 18).addBox(0.0F, 0.0F, -1.0F, 2.0F, 8.0F, 2.0F, g);
|
| 58 | CubeListBuilder rightLeg = CubeListBuilder.create().mirror().texOffs(0, 18).addBox(0.0F, 0.0F, -1.0F, 2.0F, 8.0F, 2.0F, g);
|
| 59 | root.addOrReplaceChild("right_hind_leg", rightLeg, PartPose.offset(-2.5F, 16.0F, 7.0F));
|
| 60 | root.addOrReplaceChild("left_hind_leg", leftLeg, PartPose.offset(0.5F, 16.0F, 7.0F));
|
| 61 | root.addOrReplaceChild("right_front_leg", rightLeg, PartPose.offset(-2.5F, 16.0F, -4.0F));
|
| 62 | root.addOrReplaceChild("left_front_leg", leftLeg, PartPose.offset(0.5F, 16.0F, -4.0F));
|
| 63 | PartDefinition tail = root.addOrReplaceChild(
|
| 64 | "tail", CubeListBuilder.create(), PartPose.offsetAndRotation(-1.0F, 12.0F, 8.0F, (float) (Math.PI / 5), 0.0F, 0.0F)
|
| 65 | );
|
| 66 | tail.addOrReplaceChild("real_tail", CubeListBuilder.create().texOffs(9, 18).addBox(0.0F, 0.0F, -1.0F, 2.0F, 8.0F, 2.0F, g), PartPose.ZERO);
|
| 67 | return mesh;
|
| 68 | }
|
| 69 |
|
| 70 | @Override
|
| 71 | protected void setSittingPose(final WolfRenderState state) {
|
| 72 | super.setSittingPose(state);
|
| 73 | this.upperBody.y += 2.0F;
|
| 74 | this.upperBody.xRot = (float) (Math.PI * 2.0 / 5.0);
|
| 75 | this.upperBody.yRot = 0.0F;
|
| 76 | }
|
| 77 |
|
| 78 | @Override
|
| 79 | protected void shakeOffWater(final WolfRenderState state) {
|
| 80 | super.shakeOffWater(state);
|
| 81 | this.realHead.zRot = state.headRollAngle + state.getBodyRollAngle(0.0F);
|
| 82 | this.upperBody.zRot = state.getBodyRollAngle(-0.08F);
|
| 83 | this.realTail.zRot = state.getBodyRollAngle(-0.2F);
|
| 84 | }
|
| 85 | }
|
| 86 |
|