| 1 | package net.minecraft.client.model.monster.zombie;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 | import net.minecraft.client.model.AnimationUtils;
|
| 6 | import net.minecraft.client.model.HumanoidModel;
|
| 7 | import net.minecraft.client.model.geom.ModelPart;
|
| 8 | import net.minecraft.client.model.geom.PartPose;
|
| 9 | import net.minecraft.client.model.geom.builders.CubeDeformation;
|
| 10 | import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
| 11 | import net.minecraft.client.model.geom.builders.LayerDefinition;
|
| 12 | import net.minecraft.client.model.geom.builders.MeshDefinition;
|
| 13 | import net.minecraft.client.model.geom.builders.PartDefinition;
|
| 14 | import net.minecraft.client.renderer.entity.state.ZombieRenderState;
|
| 15 | import net.minecraft.util.Mth;
|
| 16 |
|
| 17 | @Environment(EnvType.CLIENT)
|
| 18 | public class DrownedModel extends ZombieModel<ZombieRenderState> {
|
| 19 | public DrownedModel(final ModelPart root) {
|
| 20 | super(root);
|
| 21 | }
|
| 22 |
|
| 23 | public static LayerDefinition createBodyLayer(final CubeDeformation g) {
|
| 24 | MeshDefinition mesh = HumanoidModel.createMesh(g, 0.0F);
|
| 25 | PartDefinition root = mesh.getRoot();
|
| 26 | root.addOrReplaceChild(
|
| 27 | "left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, g), PartPose.offset(5.0F, 2.0F, 0.0F)
|
| 28 | );
|
| 29 | root.addOrReplaceChild(
|
| 30 | "left_leg", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, g), PartPose.offset(1.9F, 12.0F, 0.0F)
|
| 31 | );
|
| 32 | return LayerDefinition.create(mesh, 64, 64);
|
| 33 | }
|
| 34 |
|
| 35 | @Override
|
| 36 | protected void setupAttackAnimation(final ZombieRenderState state) {
|
| 37 | super.setupAttackAnimation(state);
|
| 38 | AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, state.isAggressive, state);
|
| 39 | }
|
| 40 |
|
| 41 | protected void setupSwimAnimation(final ZombieRenderState state, final float animationPos, final float swimAmount) {
|
| 42 | this.rightArm.xRot = Mth.rotLerpRad(swimAmount, this.rightArm.xRot, (float) (-Math.PI * 4.0 / 5.0)) + swimAmount * 0.35F * Mth.sin(0.1F * state.ageInTicks);
|
| 43 | this.leftArm.xRot = Mth.rotLerpRad(swimAmount, this.leftArm.xRot, (float) (-Math.PI * 4.0 / 5.0)) - swimAmount * 0.35F * Mth.sin(0.1F * state.ageInTicks);
|
| 44 | this.rightArm.zRot = Mth.rotLerpRad(swimAmount, this.rightArm.zRot, -0.15F);
|
| 45 | this.leftArm.zRot = Mth.rotLerpRad(swimAmount, this.leftArm.zRot, 0.15F);
|
| 46 | this.leftLeg.xRot = this.leftLeg.xRot - swimAmount * 0.55F * Mth.sin(0.1F * state.ageInTicks);
|
| 47 | this.rightLeg.xRot = this.rightLeg.xRot + swimAmount * 0.55F * Mth.sin(0.1F * state.ageInTicks);
|
| 48 | this.head.xRot = 0.0F;
|
| 49 | }
|
| 50 | }
|
| 51 |
|