BeeModel .java

net.minecraft.client.model.animal.bee.BeeModel (class): members: MIDDLE_LEGS, STINGER, backLeg, stinger, midLeg, bobUpAndDown, FRONT_LEGS, BACK_LEGS, BONE.

net.minecraft.client.model.animal.beeclass70 linesclientextends EntityModel<BeeRenderState>2.6 KB

API Surface (2)

void setupAnim(final BeeRenderState state)
void bobUpAndDown(final float speed, final float ageInTicks)

Fields & Constants (12)

BONE
STINGER
FRONT_LEGS
MIDDLE_LEGS
BACK_LEGS
bone
rightWing
leftWing
frontLeg
midLeg
backLeg
stinger

String literals (8)

"bone"
"stinger"
"front_legs"
"middle_legs"
"back_legs"
"body"
"right_wing"
"left_wing"

Code Graph: Dependencies (4)

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

Full Source

BeeModel.java70 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.animal.bee;
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.renderer.entity.state.BeeRenderState;
8
import net.minecraft.util.Mth;
9
10
@Environment(EnvType.CLIENT)
11
public abstract class BeeModel extends EntityModel<BeeRenderState> {
12
	protected static final String BONE = "bone";
13
	protected static final String STINGER = "stinger";
14
	protected static final String FRONT_LEGS = "front_legs";
15
	protected static final String MIDDLE_LEGS = "middle_legs";
16
	protected static final String BACK_LEGS = "back_legs";
17
	protected final ModelPart bone;
18
	private final ModelPart rightWing;
19
	private final ModelPart leftWing;
20
	private final ModelPart frontLeg;
21
	private final ModelPart midLeg;
22
	private final ModelPart backLeg;
23
	private final ModelPart stinger;
24
25
	public BeeModel(final ModelPart root) {
26
		super(root);
27
		this.bone = root.getChild("bone");
28
		ModelPart body = this.bone.getChild("body");
29
		this.stinger = body.getChild("stinger");
30
		this.rightWing = this.bone.getChild("right_wing");
31
		this.leftWing = this.bone.getChild("left_wing");
32
		this.frontLeg = this.bone.getChild("front_legs");
33
		this.midLeg = this.bone.getChild("middle_legs");
34
		this.backLeg = this.bone.getChild("back_legs");
35
	}
36
37
	public void setupAnim(final BeeRenderState state) {
38
		super.setupAnim(state);
39
		this.stinger.visible = state.hasStinger;
40
		if (!state.isOnGround) {
41
			float speed = state.ageInTicks * 120.32113F * (float) (Math.PI / 180.0);
42
			this.rightWing.yRot = 0.0F;
43
			this.rightWing.zRot = Mth.cos(speed) * (float) Math.PI * 0.15F;
44
			this.leftWing.xRot = this.rightWing.xRot;
45
			this.leftWing.yRot = this.rightWing.yRot;
46
			this.leftWing.zRot = -this.rightWing.zRot;
47
			this.frontLeg.xRot = (float) (Math.PI / 4);
48
			this.midLeg.xRot = (float) (Math.PI / 4);
49
			this.backLeg.xRot = (float) (Math.PI / 4);
50
		}
51
52
		if (!state.isAngry && !state.isOnGround) {
53
			float speed = Mth.cos(state.ageInTicks * 0.18F);
54
			this.bobUpAndDown(speed, state.ageInTicks);
55
		}
56
57
		float rollAmount = state.rollAmount;
58
		if (rollAmount > 0.0F) {
59
			this.bone.xRot = Mth.rotLerpRad(rollAmount, this.bone.xRot, 3.0915928F);
60
		}
61
	}
62
63
	protected void bobUpAndDown(final float speed, final float ageInTicks) {
64
		this.bone.xRot = 0.1F + speed * (float) Math.PI * 0.025F;
65
		this.bone.y = this.bone.y - Mth.cos(ageInTicks * 0.18F) * 0.9F;
66
		this.frontLeg.xRot = -speed * (float) Math.PI * 0.1F + (float) (Math.PI / 8);
67
		this.backLeg.xRot = -speed * (float) Math.PI * 0.05F + (float) (Math.PI / 4);
68
	}
69
}
70

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