AdultFelineModel .java

net.minecraft.client.model.animal.feline.AdultFelineModel (class): members: FRONT_LEG_Y, FRONT_LEG_Z, BACK_LEG_Y, BACK_LEG_Z, XO, YO, ZO, createBodyMesh.

net.minecraft.client.model.animal.felineclass153 linesclientextends FelineRenderState>6.5 KB

API Surface (2)

MeshDefinition createBodyMesh(final CubeDeformation g)
void setupAnim(final T state)

Fields & Constants (7)

XO
YO
ZO
BACK_LEG_Y
BACK_LEG_Z
FRONT_LEG_Y
FRONT_LEG_Z

String literals (12)

"head"
"main"
"nose"
"ear1"
"ear2"
"body"
"tail1"
"tail2"
"left_hind_leg"
"right_hind_leg"
"left_front_leg"
"right_front_leg"

Full Source

AdultFelineModel.java153 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.animal.feline;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.model.geom.ModelPart;
6
import net.minecraft.client.model.geom.PartPose;
7
import net.minecraft.client.model.geom.builders.CubeDeformation;
8
import net.minecraft.client.model.geom.builders.CubeListBuilder;
9
import net.minecraft.client.model.geom.builders.MeshDefinition;
10
import net.minecraft.client.model.geom.builders.PartDefinition;
11
import net.minecraft.client.renderer.entity.state.FelineRenderState;
12
import net.minecraft.util.Mth;
13
14
@Environment(EnvType.CLIENT)
15
public class AdultFelineModel<T extends FelineRenderState> extends AbstractFelineModel<T> {
16
	private static final float XO = 0.0F;
17
	private static final float YO = 16.0F;
18
	private static final float ZO = -9.0F;
19
	protected static final float BACK_LEG_Y = 18.0F;
20
	protected static final float BACK_LEG_Z = 5.0F;
21
	protected static final float FRONT_LEG_Y = 14.1F;
22
	private static final float FRONT_LEG_Z = -5.0F;
23
24
	public AdultFelineModel(final ModelPart root) {
25
		super(root);
26
	}
27
28
	public static MeshDefinition createBodyMesh(final CubeDeformation g) {
29
		MeshDefinition mesh = new MeshDefinition();
30
		PartDefinition root = mesh.getRoot();
31
		CubeDeformation tail_g = new CubeDeformation(-0.02F);
32
		root.addOrReplaceChild(
33
			"head",
34
			CubeListBuilder.create()
35
				.addBox("main", -2.5F, -2.0F, -3.0F, 5.0F, 4.0F, 5.0F, g)
36
				.addBox("nose", -1.5F, -0.001F, -4.0F, 3, 2, 2, g, 0, 24)
37
				.addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2, g, 0, 10)
38
				.addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2, g, 6, 10),
39
			PartPose.offset(0.0F, 15.0F, -9.0F)
40
		);
41
		root.addOrReplaceChild(
42
			"body",
43
			CubeListBuilder.create().texOffs(20, 0).addBox(-2.0F, 3.0F, -8.0F, 4.0F, 16.0F, 6.0F, g),
44
			PartPose.offsetAndRotation(0.0F, 12.0F, -10.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
45
		);
46
		root.addOrReplaceChild(
47
			"tail1",
48
			CubeListBuilder.create().texOffs(0, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, g),
49
			PartPose.offsetAndRotation(0.0F, 15.0F, 8.0F, 0.9F, 0.0F, 0.0F)
50
		);
51
		root.addOrReplaceChild(
52
			"tail2", CubeListBuilder.create().texOffs(4, 15).addBox(-0.5F, 0.0F, 0.0F, 1.0F, 8.0F, 1.0F, tail_g), PartPose.offset(0.0F, 20.0F, 14.0F)
53
		);
54
		CubeListBuilder hindLeg = CubeListBuilder.create().texOffs(8, 13).addBox(-1.0F, 0.0F, 1.0F, 2.0F, 6.0F, 2.0F, g);
55
		root.addOrReplaceChild("left_hind_leg", hindLeg, PartPose.offset(1.1F, 18.0F, 5.0F));
56
		root.addOrReplaceChild("right_hind_leg", hindLeg, PartPose.offset(-1.1F, 18.0F, 5.0F));
57
		CubeListBuilder frontLeg = CubeListBuilder.create().texOffs(40, 0).addBox(-1.0F, 0.0F, 0.0F, 2.0F, 10.0F, 2.0F, g);
58
		root.addOrReplaceChild("left_front_leg", frontLeg, PartPose.offset(1.2F, 14.1F, -5.0F));
59
		root.addOrReplaceChild("right_front_leg", frontLeg, PartPose.offset(-1.2F, 14.1F, -5.0F));
60
		return mesh;
61
	}
62
63
	public void setupAnim(final T state) {
64
		super.setupAnim(state);
65
		float ageScale = state.ageScale;
66
		if (state.isCrouching) {
67
			this.body.y += 1.0F * ageScale;
68
			this.head.y += 2.0F * ageScale;
69
			this.tail1.y += 1.0F * ageScale;
70
			this.tail2.y += -4.0F * ageScale;
71
			this.tail2.z += 2.0F * ageScale;
72
			this.tail1.xRot = (float) (Math.PI / 2);
73
			this.tail2.xRot = (float) (Math.PI / 2);
74
		} else if (state.isSprinting) {
75
			this.tail2.y = this.tail1.y;
76
			this.tail2.z += 2.0F * ageScale;
77
			this.tail1.xRot = (float) (Math.PI / 2);
78
			this.tail2.xRot = (float) (Math.PI / 2);
79
		}
80
81
		this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
82
		this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
83
		if (!state.isSitting) {
84
			this.body.xRot = (float) (Math.PI / 2);
85
			float animationSpeed = state.walkAnimationSpeed;
86
			float animationPos = state.walkAnimationPos;
87
			if (state.isSprinting) {
88
				this.leftHindLeg.xRot = Mth.cos(animationPos * 0.6662F) * animationSpeed;
89
				this.rightHindLeg.xRot = Mth.cos(animationPos * 0.6662F + 0.3F) * animationSpeed;
90
				this.leftFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI + 0.3F) * animationSpeed;
91
				this.rightFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * animationSpeed;
92
				this.tail2.xRot = 1.7278761F + (float) (Math.PI / 10) * Mth.cos(animationPos) * animationSpeed;
93
			} else {
94
				this.leftHindLeg.xRot = Mth.cos(animationPos * 0.6662F) * animationSpeed;
95
				this.rightHindLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * animationSpeed;
96
				this.leftFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * animationSpeed;
97
				this.rightFrontLeg.xRot = Mth.cos(animationPos * 0.6662F) * animationSpeed;
98
				if (!state.isCrouching) {
99
					this.tail2.xRot = 1.7278761F + (float) (Math.PI / 4) * Mth.cos(animationPos) * animationSpeed;
100
				} else {
101
					this.tail2.xRot = 1.7278761F + 0.47123894F * Mth.cos(animationPos) * animationSpeed;
102
				}
103
			}
104
		}
105
106
		if (state.isSitting) {
107
			this.body.xRot = (float) (Math.PI / 4);
108
			this.body.y += -4.0F * ageScale;
109
			this.body.z += 5.0F * ageScale;
110
			this.head.y += -3.3F * ageScale;
111
			this.head.z += 1.0F * ageScale;
112
			this.tail1.y += 8.0F * ageScale;
113
			this.tail1.z += -2.0F * ageScale;
114
			this.tail2.y += 2.0F * ageScale;
115
			this.tail2.z += -0.8F * ageScale;
116
			this.tail1.xRot = 1.7278761F;
117
			this.tail2.xRot = 2.670354F;
118
			this.leftFrontLeg.xRot = (float) (-Math.PI / 20);
119
			this.leftFrontLeg.y += 2.0F * ageScale;
120
			this.leftFrontLeg.z -= 2.0F * ageScale;
121
			this.rightFrontLeg.xRot = (float) (-Math.PI / 20);
122
			this.rightFrontLeg.y += 2.0F * ageScale;
123
			this.rightFrontLeg.z -= 2.0F * ageScale;
124
			this.leftHindLeg.xRot = (float) (-Math.PI / 2);
125
			this.leftHindLeg.y += 3.0F * ageScale;
126
			this.leftHindLeg.z -= 4.0F * ageScale;
127
			this.rightHindLeg.xRot = (float) (-Math.PI / 2);
128
			this.rightHindLeg.y += 3.0F * ageScale;
129
			this.rightHindLeg.z -= 4.0F * ageScale;
130
		}
131
132
		if (state.lieDownAmount > 0.0F) {
133
			this.head.zRot = Mth.rotLerp(state.lieDownAmount, this.head.zRot, -1.2707963F);
134
			this.head.yRot = Mth.rotLerp(state.lieDownAmount, this.head.yRot, 1.2707963F);
135
			this.leftFrontLeg.xRot = -1.2707963F;
136
			this.rightFrontLeg.xRot = -0.47079635F;
137
			this.rightFrontLeg.zRot = -0.2F;
138
			this.rightFrontLeg.x += ageScale;
139
			this.leftHindLeg.xRot = -0.4F;
140
			this.rightHindLeg.xRot = 0.5F;
141
			this.rightHindLeg.zRot = -0.5F;
142
			this.rightHindLeg.x += 0.8F * ageScale;
143
			this.rightHindLeg.y += 2.0F * ageScale;
144
			this.tail1.xRot = Mth.rotLerp(state.lieDownAmountTail, this.tail1.xRot, 0.8F);
145
			this.tail2.xRot = Mth.rotLerp(state.lieDownAmountTail, this.tail2.xRot, -0.4F);
146
		}
147
148
		if (state.relaxStateOneAmount > 0.0F) {
149
			this.head.xRot = Mth.rotLerp(state.relaxStateOneAmount, this.head.xRot, -0.58177644F);
150
		}
151
	}
152
}
153

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