| 1 | package net.minecraft.client.model.animal.bee;
|
| 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.LayerDefinition;
|
| 10 | import net.minecraft.client.model.geom.builders.MeshDefinition;
|
| 11 | import net.minecraft.client.model.geom.builders.PartDefinition;
|
| 12 |
|
| 13 | @Environment(EnvType.CLIENT)
|
| 14 | public class AdultBeeModel extends BeeModel {
|
| 15 | private static final String LEFT_ANTENNA = "left_antenna";
|
| 16 | private static final String RIGHT_ANTENNA = "right_antenna";
|
| 17 | private final ModelPart leftAntenna;
|
| 18 | private final ModelPart rightAntenna;
|
| 19 |
|
| 20 | public AdultBeeModel(final ModelPart root) {
|
| 21 | super(root);
|
| 22 | ModelPart body = this.bone.getChild("body");
|
| 23 | this.leftAntenna = body.getChild("left_antenna");
|
| 24 | this.rightAntenna = body.getChild("right_antenna");
|
| 25 | }
|
| 26 |
|
| 27 | @Override
|
| 28 | protected void bobUpAndDown(final float speed, final float ageInTicks) {
|
| 29 | super.bobUpAndDown(speed, ageInTicks);
|
| 30 | this.leftAntenna.xRot = speed * (float) Math.PI * 0.03F;
|
| 31 | this.rightAntenna.xRot = speed * (float) Math.PI * 0.03F;
|
| 32 | }
|
| 33 |
|
| 34 | public static LayerDefinition createBodyLayer() {
|
| 35 | MeshDefinition mesh = new MeshDefinition();
|
| 36 | PartDefinition root = mesh.getRoot();
|
| 37 | PartDefinition bone = root.addOrReplaceChild("bone", CubeListBuilder.create(), PartPose.offset(0.0F, 19.0F, 0.0F));
|
| 38 | PartDefinition body = bone.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-3.5F, -4.0F, -5.0F, 7.0F, 7.0F, 10.0F), PartPose.ZERO);
|
| 39 | body.addOrReplaceChild("stinger", CubeListBuilder.create().texOffs(26, 7).addBox(0.0F, -1.0F, 5.0F, 0.0F, 1.0F, 2.0F), PartPose.ZERO);
|
| 40 | body.addOrReplaceChild(
|
| 41 | "left_antenna", CubeListBuilder.create().texOffs(2, 0).addBox(1.5F, -2.0F, -3.0F, 1.0F, 2.0F, 3.0F), PartPose.offset(0.0F, -2.0F, -5.0F)
|
| 42 | );
|
| 43 | body.addOrReplaceChild(
|
| 44 | "right_antenna", CubeListBuilder.create().texOffs(2, 3).addBox(-2.5F, -2.0F, -3.0F, 1.0F, 2.0F, 3.0F), PartPose.offset(0.0F, -2.0F, -5.0F)
|
| 45 | );
|
| 46 | CubeDeformation wingDeformation = new CubeDeformation(0.001F);
|
| 47 | bone.addOrReplaceChild(
|
| 48 | "right_wing",
|
| 49 | CubeListBuilder.create().texOffs(0, 18).addBox(-9.0F, 0.0F, 0.0F, 9.0F, 0.0F, 6.0F, wingDeformation),
|
| 50 | PartPose.offsetAndRotation(-1.5F, -4.0F, -3.0F, 0.0F, -0.2618F, 0.0F)
|
| 51 | );
|
| 52 | bone.addOrReplaceChild(
|
| 53 | "left_wing",
|
| 54 | CubeListBuilder.create().texOffs(0, 18).mirror().addBox(0.0F, 0.0F, 0.0F, 9.0F, 0.0F, 6.0F, wingDeformation),
|
| 55 | PartPose.offsetAndRotation(1.5F, -4.0F, -3.0F, 0.0F, 0.2618F, 0.0F)
|
| 56 | );
|
| 57 | bone.addOrReplaceChild("front_legs", CubeListBuilder.create().addBox("front_legs", -5.0F, 0.0F, 0.0F, 7, 2, 0, 26, 1), PartPose.offset(1.5F, 3.0F, -2.0F));
|
| 58 | bone.addOrReplaceChild("middle_legs", CubeListBuilder.create().addBox("middle_legs", -5.0F, 0.0F, 0.0F, 7, 2, 0, 26, 3), PartPose.offset(1.5F, 3.0F, 0.0F));
|
| 59 | bone.addOrReplaceChild("back_legs", CubeListBuilder.create().addBox("back_legs", -5.0F, 0.0F, 0.0F, 7, 2, 0, 26, 5), PartPose.offset(1.5F, 3.0F, 2.0F));
|
| 60 | return LayerDefinition.create(mesh, 64, 64);
|
| 61 | }
|
| 62 | }
|
| 63 |
|