| 1 | package net.minecraft.client.model.animal.fish;
|
| 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.EntityRenderState;
|
| 13 | import net.minecraft.util.Mth;
|
| 14 |
|
| 15 | @Environment(EnvType.CLIENT)
|
| 16 | public class PufferfishBigModel extends EntityModel<EntityRenderState> {
|
| 17 | private final ModelPart leftBlueFin;
|
| 18 | private final ModelPart rightBlueFin;
|
| 19 |
|
| 20 | public PufferfishBigModel(final ModelPart root) {
|
| 21 | super(root);
|
| 22 | this.leftBlueFin = root.getChild("left_blue_fin");
|
| 23 | this.rightBlueFin = root.getChild("right_blue_fin");
|
| 24 | }
|
| 25 |
|
| 26 | public static LayerDefinition createBodyLayer() {
|
| 27 | MeshDefinition mesh = new MeshDefinition();
|
| 28 | PartDefinition root = mesh.getRoot();
|
| 29 | int yo = 22;
|
| 30 | root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.offset(0.0F, 22.0F, 0.0F));
|
| 31 | root.addOrReplaceChild(
|
| 32 | "right_blue_fin", CubeListBuilder.create().texOffs(24, 0).addBox(-2.0F, 0.0F, -1.0F, 2.0F, 1.0F, 2.0F), PartPose.offset(-4.0F, 15.0F, -2.0F)
|
| 33 | );
|
| 34 | root.addOrReplaceChild(
|
| 35 | "left_blue_fin", CubeListBuilder.create().texOffs(24, 3).addBox(0.0F, 0.0F, -1.0F, 2.0F, 1.0F, 2.0F), PartPose.offset(4.0F, 15.0F, -2.0F)
|
| 36 | );
|
| 37 | root.addOrReplaceChild(
|
| 38 | "top_front_fin",
|
| 39 | CubeListBuilder.create().texOffs(15, 17).addBox(-4.0F, -1.0F, 0.0F, 8.0F, 1.0F, 0.0F),
|
| 40 | PartPose.offsetAndRotation(0.0F, 14.0F, -4.0F, (float) (Math.PI / 4), 0.0F, 0.0F)
|
| 41 | );
|
| 42 | root.addOrReplaceChild(
|
| 43 | "top_middle_fin", CubeListBuilder.create().texOffs(14, 16).addBox(-4.0F, -1.0F, 0.0F, 8.0F, 1.0F, 1.0F), PartPose.offset(0.0F, 14.0F, 0.0F)
|
| 44 | );
|
| 45 | root.addOrReplaceChild(
|
| 46 | "top_back_fin",
|
| 47 | CubeListBuilder.create().texOffs(23, 18).addBox(-4.0F, -1.0F, 0.0F, 8.0F, 1.0F, 0.0F),
|
| 48 | PartPose.offsetAndRotation(0.0F, 14.0F, 4.0F, (float) (-Math.PI / 4), 0.0F, 0.0F)
|
| 49 | );
|
| 50 | root.addOrReplaceChild(
|
| 51 | "right_front_fin",
|
| 52 | CubeListBuilder.create().texOffs(5, 17).addBox(-1.0F, -8.0F, 0.0F, 1.0F, 8.0F, 0.0F),
|
| 53 | PartPose.offsetAndRotation(-4.0F, 22.0F, -4.0F, 0.0F, (float) (-Math.PI / 4), 0.0F)
|
| 54 | );
|
| 55 | root.addOrReplaceChild(
|
| 56 | "left_front_fin",
|
| 57 | CubeListBuilder.create().texOffs(1, 17).addBox(0.0F, -8.0F, 0.0F, 1.0F, 8.0F, 0.0F),
|
| 58 | PartPose.offsetAndRotation(4.0F, 22.0F, -4.0F, 0.0F, (float) (Math.PI / 4), 0.0F)
|
| 59 | );
|
| 60 | root.addOrReplaceChild(
|
| 61 | "bottom_front_fin",
|
| 62 | CubeListBuilder.create().texOffs(15, 20).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 1.0F, 0.0F),
|
| 63 | PartPose.offsetAndRotation(0.0F, 22.0F, -4.0F, (float) (-Math.PI / 4), 0.0F, 0.0F)
|
| 64 | );
|
| 65 | root.addOrReplaceChild(
|
| 66 | "bottom_middle_fin", CubeListBuilder.create().texOffs(15, 20).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 1.0F, 0.0F), PartPose.offset(0.0F, 22.0F, 0.0F)
|
| 67 | );
|
| 68 | root.addOrReplaceChild(
|
| 69 | "bottom_back_fin",
|
| 70 | CubeListBuilder.create().texOffs(15, 20).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 1.0F, 0.0F),
|
| 71 | PartPose.offsetAndRotation(0.0F, 22.0F, 4.0F, (float) (Math.PI / 4), 0.0F, 0.0F)
|
| 72 | );
|
| 73 | root.addOrReplaceChild(
|
| 74 | "right_back_fin",
|
| 75 | CubeListBuilder.create().texOffs(9, 17).addBox(-1.0F, -8.0F, 0.0F, 1.0F, 8.0F, 0.0F),
|
| 76 | PartPose.offsetAndRotation(-4.0F, 22.0F, 4.0F, 0.0F, (float) (Math.PI / 4), 0.0F)
|
| 77 | );
|
| 78 | root.addOrReplaceChild(
|
| 79 | "left_back_fin",
|
| 80 | CubeListBuilder.create().texOffs(9, 17).addBox(0.0F, -8.0F, 0.0F, 1.0F, 8.0F, 0.0F),
|
| 81 | PartPose.offsetAndRotation(4.0F, 22.0F, 4.0F, 0.0F, (float) (-Math.PI / 4), 0.0F)
|
| 82 | );
|
| 83 | return LayerDefinition.create(mesh, 32, 32);
|
| 84 | }
|
| 85 |
|
| 86 | public void setupAnim(final EntityRenderState state) {
|
| 87 | super.setupAnim(state);
|
| 88 | this.rightBlueFin.zRot = -0.2F + 0.4F * Mth.sin(state.ageInTicks * 0.2F);
|
| 89 | this.leftBlueFin.zRot = 0.2F - 0.4F * Mth.sin(state.ageInTicks * 0.2F);
|
| 90 | }
|
| 91 | }
|
| 92 |
|