PhantomModel .java

net.minecraft.client.model.monster.phantom.PhantomModel (class): members: rightWingBase, leftWingBase, TAIL_BASE, TAIL_TIP, tailBase, tailTip, leftWingTip.

net.minecraft.client.model.monster.phantomclass87 linesclientextends EntityModel<PhantomRenderState>3.9 KB

API Surface (2)

LayerDefinition createBodyLayer()
void setupAnim(final PhantomRenderState state)

Fields & Constants (8)

TAIL_BASE
TAIL_TIP
leftWingBase
leftWingTip
rightWingBase
rightWingTip
tailBase
tailTip

String literals (8)

"tail_base"
"tail_tip"
"body"
"left_wing_base"
"left_wing_tip"
"right_wing_base"
"right_wing_tip"
"head"

Same Package (1)

Full Source

PhantomModel.java87 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.monster.phantom;
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.CubeListBuilder;
9
import net.minecraft.client.model.geom.builders.LayerDefinition;
10
import net.minecraft.client.model.geom.builders.MeshDefinition;
11
import net.minecraft.client.model.geom.builders.PartDefinition;
12
import net.minecraft.client.renderer.entity.state.PhantomRenderState;
13
import net.minecraft.util.Mth;
14
15
@Environment(EnvType.CLIENT)
16
public class PhantomModel extends EntityModel<PhantomRenderState> {
17
	private static final String TAIL_BASE = "tail_base";
18
	private static final String TAIL_TIP = "tail_tip";
19
	private final ModelPart leftWingBase;
20
	private final ModelPart leftWingTip;
21
	private final ModelPart rightWingBase;
22
	private final ModelPart rightWingTip;
23
	private final ModelPart tailBase;
24
	private final ModelPart tailTip;
25
26
	public PhantomModel(final ModelPart root) {
27
		super(root);
28
		ModelPart body = root.getChild("body");
29
		this.tailBase = body.getChild("tail_base");
30
		this.tailTip = this.tailBase.getChild("tail_tip");
31
		this.leftWingBase = body.getChild("left_wing_base");
32
		this.leftWingTip = this.leftWingBase.getChild("left_wing_tip");
33
		this.rightWingBase = body.getChild("right_wing_base");
34
		this.rightWingTip = this.rightWingBase.getChild("right_wing_tip");
35
	}
36
37
	public static LayerDefinition createBodyLayer() {
38
		MeshDefinition mesh = new MeshDefinition();
39
		PartDefinition root = mesh.getRoot();
40
		PartDefinition body = root.addOrReplaceChild(
41
			"body", CubeListBuilder.create().texOffs(0, 8).addBox(-3.0F, -2.0F, -8.0F, 5.0F, 3.0F, 9.0F), PartPose.rotation(-0.1F, 0.0F, 0.0F)
42
		);
43
		PartDefinition tailBase = body.addOrReplaceChild(
44
			"tail_base", CubeListBuilder.create().texOffs(3, 20).addBox(-2.0F, 0.0F, 0.0F, 3.0F, 2.0F, 6.0F), PartPose.offset(0.0F, -2.0F, 1.0F)
45
		);
46
		tailBase.addOrReplaceChild("tail_tip", CubeListBuilder.create().texOffs(4, 29).addBox(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 6.0F), PartPose.offset(0.0F, 0.5F, 6.0F));
47
		PartDefinition leftWingBase = body.addOrReplaceChild(
48
			"left_wing_base",
49
			CubeListBuilder.create().texOffs(23, 12).addBox(0.0F, 0.0F, 0.0F, 6.0F, 2.0F, 9.0F),
50
			PartPose.offsetAndRotation(2.0F, -2.0F, -8.0F, 0.0F, 0.0F, 0.1F)
51
		);
52
		leftWingBase.addOrReplaceChild(
53
			"left_wing_tip",
54
			CubeListBuilder.create().texOffs(16, 24).addBox(0.0F, 0.0F, 0.0F, 13.0F, 1.0F, 9.0F),
55
			PartPose.offsetAndRotation(6.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.1F)
56
		);
57
		PartDefinition rightWingBase = body.addOrReplaceChild(
58
			"right_wing_base",
59
			CubeListBuilder.create().texOffs(23, 12).mirror().addBox(-6.0F, 0.0F, 0.0F, 6.0F, 2.0F, 9.0F),
60
			PartPose.offsetAndRotation(-3.0F, -2.0F, -8.0F, 0.0F, 0.0F, -0.1F)
61
		);
62
		rightWingBase.addOrReplaceChild(
63
			"right_wing_tip",
64
			CubeListBuilder.create().texOffs(16, 24).mirror().addBox(-13.0F, 0.0F, 0.0F, 13.0F, 1.0F, 9.0F),
65
			PartPose.offsetAndRotation(-6.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.1F)
66
		);
67
		body.addOrReplaceChild(
68
			"head",
69
			CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -2.0F, -5.0F, 7.0F, 3.0F, 5.0F),
70
			PartPose.offsetAndRotation(0.0F, 1.0F, -7.0F, 0.2F, 0.0F, 0.0F)
71
		);
72
		return LayerDefinition.create(mesh, 64, 64);
73
	}
74
75
	public void setupAnim(final PhantomRenderState state) {
76
		super.setupAnim(state);
77
		float anim = state.flapTime * 7.448451F * (float) (Math.PI / 180.0);
78
		float flapAmount = 16.0F;
79
		this.leftWingBase.zRot = Mth.cos(anim) * 16.0F * (float) (Math.PI / 180.0);
80
		this.leftWingTip.zRot = Mth.cos(anim) * 16.0F * (float) (Math.PI / 180.0);
81
		this.rightWingBase.zRot = -this.leftWingBase.zRot;
82
		this.rightWingTip.zRot = -this.leftWingTip.zRot;
83
		this.tailBase.xRot = -(5.0F + Mth.cos(anim * 2.0F) * 5.0F) * (float) (Math.PI / 180.0);
84
		this.tailTip.xRot = -(5.0F + Mth.cos(anim * 2.0F) * 5.0F) * (float) (Math.PI / 180.0);
85
	}
86
}
87

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