| 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 PufferfishMidModel extends EntityModel<EntityRenderState> {
|
| 17 | private final ModelPart leftBlueFin;
|
| 18 | private final ModelPart rightBlueFin;
|
| 19 |
|
| 20 | public PufferfishMidModel(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(12, 22).addBox(-2.5F, -5.0F, -2.5F, 5.0F, 5.0F, 5.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, 0.0F, 2.0F, 0.0F, 2.0F), PartPose.offset(-2.5F, 18.0F, -1.5F)
|
| 33 | );
|
| 34 | root.addOrReplaceChild(
|
| 35 | "left_blue_fin", CubeListBuilder.create().texOffs(24, 3).addBox(0.0F, 0.0F, 0.0F, 2.0F, 0.0F, 2.0F), PartPose.offset(2.5F, 18.0F, -1.5F)
|
| 36 | );
|
| 37 | root.addOrReplaceChild(
|
| 38 | "top_front_fin",
|
| 39 | CubeListBuilder.create().texOffs(19, 17).addBox(-2.5F, -1.0F, 0.0F, 5.0F, 1.0F, 0.0F),
|
| 40 | PartPose.offsetAndRotation(0.0F, 17.0F, -2.5F, (float) (Math.PI / 4), 0.0F, 0.0F)
|
| 41 | );
|
| 42 | root.addOrReplaceChild(
|
| 43 | "top_back_fin",
|
| 44 | CubeListBuilder.create().texOffs(11, 17).addBox(-2.5F, -1.0F, 0.0F, 5.0F, 1.0F, 0.0F),
|
| 45 | PartPose.offsetAndRotation(0.0F, 17.0F, 2.5F, (float) (-Math.PI / 4), 0.0F, 0.0F)
|
| 46 | );
|
| 47 | root.addOrReplaceChild(
|
| 48 | "right_front_fin",
|
| 49 | CubeListBuilder.create().texOffs(5, 17).addBox(-1.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F),
|
| 50 | PartPose.offsetAndRotation(-2.5F, 22.0F, -2.5F, 0.0F, (float) (-Math.PI / 4), 0.0F)
|
| 51 | );
|
| 52 | root.addOrReplaceChild(
|
| 53 | "right_back_fin",
|
| 54 | CubeListBuilder.create().texOffs(9, 17).addBox(-1.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F),
|
| 55 | PartPose.offsetAndRotation(-2.5F, 22.0F, 2.5F, 0.0F, (float) (Math.PI / 4), 0.0F)
|
| 56 | );
|
| 57 | root.addOrReplaceChild(
|
| 58 | "left_back_fin",
|
| 59 | CubeListBuilder.create().texOffs(1, 17).addBox(0.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F),
|
| 60 | PartPose.offsetAndRotation(2.5F, 22.0F, 2.5F, 0.0F, (float) (-Math.PI / 4), 0.0F)
|
| 61 | );
|
| 62 | root.addOrReplaceChild(
|
| 63 | "left_front_fin",
|
| 64 | CubeListBuilder.create().texOffs(1, 17).addBox(0.0F, -5.0F, 0.0F, 1.0F, 5.0F, 0.0F),
|
| 65 | PartPose.offsetAndRotation(2.5F, 22.0F, -2.5F, 0.0F, (float) (Math.PI / 4), 0.0F)
|
| 66 | );
|
| 67 | root.addOrReplaceChild(
|
| 68 | "bottom_back_fin",
|
| 69 | CubeListBuilder.create().texOffs(18, 20).addBox(0.0F, 0.0F, 0.0F, 5.0F, 1.0F, 0.0F),
|
| 70 | PartPose.offsetAndRotation(-2.5F, 22.0F, 2.5F, (float) (Math.PI / 4), 0.0F, 0.0F)
|
| 71 | );
|
| 72 | root.addOrReplaceChild(
|
| 73 | "bottom_front_fin",
|
| 74 | CubeListBuilder.create().texOffs(17, 19).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 1.0F, 1.0F),
|
| 75 | PartPose.offsetAndRotation(0.0F, 22.0F, -2.5F, (float) (-Math.PI / 4), 0.0F, 0.0F)
|
| 76 | );
|
| 77 | return LayerDefinition.create(mesh, 32, 32);
|
| 78 | }
|
| 79 |
|
| 80 | public void setupAnim(final EntityRenderState state) {
|
| 81 | super.setupAnim(state);
|
| 82 | this.rightBlueFin.zRot = -0.2F + 0.4F * Mth.sin(state.ageInTicks * 0.2F);
|
| 83 | this.leftBlueFin.zRot = 0.2F - 0.4F * Mth.sin(state.ageInTicks * 0.2F);
|
| 84 | }
|
| 85 | }
|
| 86 |
|