DrownedModel .java

net.minecraft.client.model.monster.zombie.DrownedModel (class): members: setupSwimAnimation, setupAttackAnimation, createBodyLayer. strings: "left_arm".

net.minecraft.client.model.monster.zombieclass51 linesclientextends ZombieModel<ZombieRenderState>2.4 KB

API Surface (3)

LayerDefinition createBodyLayer(final CubeDeformation g)
void setupAttackAnimation(final ZombieRenderState state)
void setupSwimAnimation(final ZombieRenderState state, final float animationPos, final float swimAmount)

String literals (2)

"left_arm"
"left_leg"

Full Source

DrownedModel.java51 lines · Minecraft 26.3 · verbatim
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

Decompiled Minecraft 26.3 source of DrownedModel (net/minecraft/client/model/monster/zombie/DrownedModel.java) with Mojang official mappings, stored verbatim on the site.