RabbitModel .java

net.minecraft.client.model.animal.rabbit.RabbitModel (class): members: idleHeadTiltAnimation, RIGHT_HAUNCH, hopAnimation, LEFT_HAUNCH, FRONT_LEGS, head.

net.minecraft.client.model.animal.rabbitclass39 linesclientextends EntityModel<RabbitRenderState>1.5 KB

API Surface (1)

void setupAnim(final RabbitRenderState state)

Fields & Constants (7)

FRONT_LEGS
BACK_LEGS
LEFT_HAUNCH
RIGHT_HAUNCH
hopAnimation
idleHeadTiltAnimation
head

String literals (6)

"frontlegs"
"backlegs"
"left_haunch"
"right_haunch"
"body"
"head"

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

RabbitModel.java39 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.animal.rabbit;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.animation.AnimationDefinition;
6
import net.minecraft.client.animation.KeyframeAnimation;
7
import net.minecraft.client.model.EntityModel;
8
import net.minecraft.client.model.geom.ModelPart;
9
import net.minecraft.client.renderer.entity.state.RabbitRenderState;
10
11
@Environment(EnvType.CLIENT)
12
public abstract class RabbitModel extends EntityModel<RabbitRenderState> {
13
	protected static final String FRONT_LEGS = "frontlegs";
14
	protected static final String BACK_LEGS = "backlegs";
15
	protected static final String LEFT_HAUNCH = "left_haunch";
16
	protected static final String RIGHT_HAUNCH = "right_haunch";
17
	private final KeyframeAnimation hopAnimation;
18
	private final KeyframeAnimation idleHeadTiltAnimation;
19
	private final ModelPart head;
20
21
	public RabbitModel(final ModelPart root, final AnimationDefinition hop, final AnimationDefinition idleHeadTilt) {
22
		super(root);
23
		this.head = root.getChild("body").getChild("head");
24
		this.hopAnimation = hop.bake(root);
25
		this.idleHeadTiltAnimation = idleHeadTilt.bake(root);
26
	}
27
28
	public void setupAnim(final RabbitRenderState state) {
29
		super.setupAnim(state);
30
		if (!state.idleHeadTiltAnimationState.isStarted()) {
31
			this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
32
			this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
33
		}
34
35
		this.hopAnimation.apply(state.hopAnimationState, state.ageInTicks);
36
		this.idleHeadTiltAnimation.apply(state.idleHeadTiltAnimationState, state.ageInTicks);
37
	}
38
}
39

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