| 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.LivingEntityRenderState;
|
| 13 | import net.minecraft.util.Mth;
|
| 14 |
|
| 15 | @Environment(EnvType.CLIENT)
|
| 16 | public class CodModel extends EntityModel<LivingEntityRenderState> {
|
| 17 | private final ModelPart tailFin;
|
| 18 |
|
| 19 | public CodModel(final ModelPart root) {
|
| 20 | super(root);
|
| 21 | this.tailFin = root.getChild("tail_fin");
|
| 22 | }
|
| 23 |
|
| 24 | public static LayerDefinition createBodyLayer() {
|
| 25 | MeshDefinition mesh = new MeshDefinition();
|
| 26 | PartDefinition root = mesh.getRoot();
|
| 27 | int yo = 22;
|
| 28 | root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -2.0F, 0.0F, 2.0F, 4.0F, 7.0F), PartPose.offset(0.0F, 22.0F, 0.0F));
|
| 29 | root.addOrReplaceChild("head", CubeListBuilder.create().texOffs(11, 0).addBox(-1.0F, -2.0F, -3.0F, 2.0F, 4.0F, 3.0F), PartPose.offset(0.0F, 22.0F, 0.0F));
|
| 30 | root.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -2.0F, -1.0F, 2.0F, 3.0F, 1.0F), PartPose.offset(0.0F, 22.0F, -3.0F));
|
| 31 | root.addOrReplaceChild(
|
| 32 | "right_fin",
|
| 33 | CubeListBuilder.create().texOffs(22, 1).addBox(-2.0F, 0.0F, -1.0F, 2.0F, 0.0F, 2.0F),
|
| 34 | PartPose.offsetAndRotation(-1.0F, 23.0F, 0.0F, 0.0F, 0.0F, (float) (-Math.PI / 4))
|
| 35 | );
|
| 36 | root.addOrReplaceChild(
|
| 37 | "left_fin",
|
| 38 | CubeListBuilder.create().texOffs(22, 4).addBox(0.0F, 0.0F, -1.0F, 2.0F, 0.0F, 2.0F),
|
| 39 | PartPose.offsetAndRotation(1.0F, 23.0F, 0.0F, 0.0F, 0.0F, (float) (Math.PI / 4))
|
| 40 | );
|
| 41 | root.addOrReplaceChild("tail_fin", CubeListBuilder.create().texOffs(22, 3).addBox(0.0F, -2.0F, 0.0F, 0.0F, 4.0F, 4.0F), PartPose.offset(0.0F, 22.0F, 7.0F));
|
| 42 | root.addOrReplaceChild("top_fin", CubeListBuilder.create().texOffs(20, -6).addBox(0.0F, -1.0F, -1.0F, 0.0F, 1.0F, 6.0F), PartPose.offset(0.0F, 20.0F, 0.0F));
|
| 43 | return LayerDefinition.create(mesh, 32, 32);
|
| 44 | }
|
| 45 |
|
| 46 | public void setupAnim(final LivingEntityRenderState state) {
|
| 47 | super.setupAnim(state);
|
| 48 | float amplitudeMultiplier = state.isInWater ? 1.0F : 1.5F;
|
| 49 | this.tailFin.yRot = -amplitudeMultiplier * 0.45F * Mth.sin(0.6F * state.ageInTicks);
|
| 50 | }
|
| 51 | }
|
| 52 |
|