| 1 | package net.minecraft.client.model.animal.panda;
|
| 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 | import net.minecraft.client.renderer.entity.state.PandaRenderState;
|
| 12 | import net.minecraft.util.Mth;
|
| 13 |
|
| 14 | @Environment(EnvType.CLIENT)
|
| 15 | public class BabyPandaModel extends PandaModel {
|
| 16 | public BabyPandaModel(final ModelPart root) {
|
| 17 | super(root);
|
| 18 | }
|
| 19 |
|
| 20 | public static LayerDefinition createBodyLayer() {
|
| 21 | MeshDefinition mesh = new MeshDefinition();
|
| 22 | PartDefinition root = mesh.getRoot();
|
| 23 | root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 11).addBox(-4.5F, -3.5F, -5.5F, 9.0F, 7.0F, 11.0F), PartPose.offset(0.0F, 18.5F, 2.5F));
|
| 24 | root.addOrReplaceChild(
|
| 25 | "head",
|
| 26 | CubeListBuilder.create()
|
| 27 | .texOffs(0, 0)
|
| 28 | .addBox(-3.5F, -3.0F, -5.0F, 7.0F, 6.0F, 5.0F)
|
| 29 | .texOffs(24, 6)
|
| 30 | .addBox(-2.0F, 1.0F, -6.0F, 4.0F, 2.0F, 1.0F)
|
| 31 | .texOffs(24, 0)
|
| 32 | .addBox(-4.5F, -4.0F, -3.5F, 3.0F, 3.0F, 1.0F)
|
| 33 | .texOffs(33, 0)
|
| 34 | .addBox(1.5F, -4.0F, -3.5F, 3.0F, 3.0F, 1.0F),
|
| 35 | PartPose.offset(0.0F, 19.0F, -3.0F)
|
| 36 | );
|
| 37 | root.addOrReplaceChild(
|
| 38 | "right_hind_leg", CubeListBuilder.create().texOffs(0, 34).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 2.0F, 3.0F), PartPose.offset(-3.0F, 22.0F, 6.5F)
|
| 39 | );
|
| 40 | root.addOrReplaceChild(
|
| 41 | "left_hind_leg", CubeListBuilder.create().texOffs(12, 34).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 2.0F, 3.0F), PartPose.offset(3.0F, 22.0F, 6.5F)
|
| 42 | );
|
| 43 | root.addOrReplaceChild(
|
| 44 | "right_front_leg", CubeListBuilder.create().texOffs(0, 29).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 2.0F, 3.0F), PartPose.offset(-3.0F, 22.0F, -1.5F)
|
| 45 | );
|
| 46 | root.addOrReplaceChild(
|
| 47 | "left_front_leg", CubeListBuilder.create().texOffs(12, 29).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 2.0F, 3.0F), PartPose.offset(3.0F, 22.0F, -1.5F)
|
| 48 | );
|
| 49 | return LayerDefinition.create(mesh, 64, 64);
|
| 50 | }
|
| 51 |
|
| 52 | @Override
|
| 53 | protected void animateSitting(final PandaRenderState state) {
|
| 54 | this.body.xRot = Mth.rotLerpRad(state.sitAmount, this.body.xRot, (float) (Math.PI / 18));
|
| 55 | this.body.z = Mth.lerp(state.sitAmount, this.body.z, -1.5F);
|
| 56 | this.head.z = Mth.lerp(state.sitAmount, this.head.z, -11.5F);
|
| 57 | this.head.y = Mth.lerp(state.sitAmount, this.head.y, 17.5F);
|
| 58 | this.rightFrontLeg.z = Mth.lerp(state.sitAmount, this.rightFrontLeg.z, -5.0F);
|
| 59 | this.leftFrontLeg.z = Mth.lerp(state.sitAmount, this.leftFrontLeg.z, -5.0F);
|
| 60 | this.rightHindLeg.z = Mth.lerp(state.sitAmount, this.rightHindLeg.z, 3.0F);
|
| 61 | this.leftHindLeg.z = Mth.lerp(state.sitAmount, this.leftHindLeg.z, 3.0F);
|
| 62 | this.rightFrontLeg.zRot = -0.27079642F;
|
| 63 | this.leftFrontLeg.zRot = 0.27079642F;
|
| 64 | this.rightHindLeg.zRot = 0.5707964F;
|
| 65 | this.leftHindLeg.zRot = -0.5707964F;
|
| 66 | }
|
| 67 | }
|
| 68 |
|