WitherBossModel .java

net.minecraft.client.model.monster.wither.WitherBossModel (class): members: RIBCAGE_X_ROT_OFFSET, TAIL_X_ROT_OFFSET, CENTER_HEAD, RIGHT_HEAD, centerHead.

net.minecraft.client.model.monster.witherclass86 linesclientextends EntityModel<WitherRenderState>3.9 KB

API Surface (2)

LayerDefinition createBodyLayer(final CubeDeformation g)
void setupAnim(final WitherRenderState state)

Fields & Constants (11)

RIBCAGE
CENTER_HEAD
RIGHT_HEAD
LEFT_HEAD
RIBCAGE_X_ROT_OFFSET
TAIL_X_ROT_OFFSET
centerHead
rightHead
leftHead
ribcage
tail

String literals (6)

"ribcage"
"center_head"
"right_head"
"left_head"
"tail"
"shoulders"

Same Package (1)

Full Source

WitherBossModel.java86 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.monster.wither;
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.model.geom.PartPose;
8
import net.minecraft.client.model.geom.builders.CubeDeformation;
9
import net.minecraft.client.model.geom.builders.CubeListBuilder;
10
import net.minecraft.client.model.geom.builders.LayerDefinition;
11
import net.minecraft.client.model.geom.builders.MeshDefinition;
12
import net.minecraft.client.model.geom.builders.PartDefinition;
13
import net.minecraft.client.renderer.entity.state.WitherRenderState;
14
import net.minecraft.util.Mth;
15
16
@Environment(EnvType.CLIENT)
17
public class WitherBossModel extends EntityModel<WitherRenderState> {
18
	private static final String RIBCAGE = "ribcage";
19
	private static final String CENTER_HEAD = "center_head";
20
	private static final String RIGHT_HEAD = "right_head";
21
	private static final String LEFT_HEAD = "left_head";
22
	private static final float RIBCAGE_X_ROT_OFFSET = 0.065F;
23
	private static final float TAIL_X_ROT_OFFSET = 0.265F;
24
	private final ModelPart centerHead;
25
	private final ModelPart rightHead;
26
	private final ModelPart leftHead;
27
	private final ModelPart ribcage;
28
	private final ModelPart tail;
29
30
	public WitherBossModel(final ModelPart root) {
31
		super(root);
32
		this.ribcage = root.getChild("ribcage");
33
		this.tail = root.getChild("tail");
34
		this.centerHead = root.getChild("center_head");
35
		this.rightHead = root.getChild("right_head");
36
		this.leftHead = root.getChild("left_head");
37
	}
38
39
	public static LayerDefinition createBodyLayer(final CubeDeformation g) {
40
		MeshDefinition mesh = new MeshDefinition();
41
		PartDefinition root = mesh.getRoot();
42
		root.addOrReplaceChild("shoulders", CubeListBuilder.create().texOffs(0, 16).addBox(-10.0F, 3.9F, -0.5F, 20.0F, 3.0F, 3.0F, g), PartPose.ZERO);
43
		float ribcageXRot = 0.20420352F;
44
		root.addOrReplaceChild(
45
			"ribcage",
46
			CubeListBuilder.create()
47
				.texOffs(0, 22)
48
				.addBox(0.0F, 0.0F, 0.0F, 3.0F, 10.0F, 3.0F, g)
49
				.texOffs(24, 22)
50
				.addBox(-4.0F, 1.5F, 0.5F, 11.0F, 2.0F, 2.0F, g)
51
				.texOffs(24, 22)
52
				.addBox(-4.0F, 4.0F, 0.5F, 11.0F, 2.0F, 2.0F, g)
53
				.texOffs(24, 22)
54
				.addBox(-4.0F, 6.5F, 0.5F, 11.0F, 2.0F, 2.0F, g),
55
			PartPose.offsetAndRotation(-2.0F, 6.9F, -0.5F, 0.20420352F, 0.0F, 0.0F)
56
		);
57
		root.addOrReplaceChild(
58
			"tail",
59
			CubeListBuilder.create().texOffs(12, 22).addBox(0.0F, 0.0F, 0.0F, 3.0F, 6.0F, 3.0F, g),
60
			PartPose.offsetAndRotation(-2.0F, 6.9F + Mth.cos(0.20420352F) * 10.0F, -0.5F + Mth.sin(0.20420352F) * 10.0F, 0.83252203F, 0.0F, 0.0F)
61
		);
62
		root.addOrReplaceChild("center_head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 8.0F, 8.0F, g), PartPose.ZERO);
63
		CubeListBuilder sideHead = CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -4.0F, -4.0F, 6.0F, 6.0F, 6.0F, g);
64
		root.addOrReplaceChild("right_head", sideHead, PartPose.offset(-8.0F, 4.0F, 0.0F));
65
		root.addOrReplaceChild("left_head", sideHead, PartPose.offset(10.0F, 4.0F, 0.0F));
66
		return LayerDefinition.create(mesh, 64, 64);
67
	}
68
69
	public void setupAnim(final WitherRenderState state) {
70
		super.setupAnim(state);
71
		setupHeadRotation(state, this.rightHead, 0);
72
		setupHeadRotation(state, this.leftHead, 1);
73
		float anim = Mth.cos(state.ageInTicks * 0.1F);
74
		this.ribcage.xRot = (0.065F + 0.05F * anim) * (float) Math.PI;
75
		this.tail.setPos(-2.0F, 6.9F + Mth.cos(this.ribcage.xRot) * 10.0F, -0.5F + Mth.sin(this.ribcage.xRot) * 10.0F);
76
		this.tail.xRot = (0.265F + 0.1F * anim) * (float) Math.PI;
77
		this.centerHead.yRot = state.yRot * (float) (Math.PI / 180.0);
78
		this.centerHead.xRot = state.xRot * (float) (Math.PI / 180.0);
79
	}
80
81
	private static void setupHeadRotation(final WitherRenderState state, final ModelPart head, final int headIndex) {
82
		head.yRot = (state.yHeadRots[headIndex] - state.bodyRot) * (float) (Math.PI / 180.0);
83
		head.xRot = state.xHeadRots[headIndex] * (float) (Math.PI / 180.0);
84
	}
85
}
86

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