WitchModel.java
net.minecraft.client.model.monster.witch.WitchModel
信息
- 全限定名:net.minecraft.client.model.monster.witch.WitchModel
- 类型:public class
- 包:net.minecraft.client.model.monster.witch
- 源码路径:src/main/java/net/minecraft/client/model/monster/witch/WitchModel.java
- 起始行号:L21
- 继承:EntityModel
- 实现:HeadedModel, VillagerLikeModel
- 职责:
TODO
字段/常量
-
nose- 类型:
ModelPart - 修饰符:
protected final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
head- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
rightLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
leftLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L25 - 说明:
TODO
- 类型:
-
arms- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L26 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public WitchModel(ModelPart root) @ L28
- 构造器名:WitchModel
- 源码定位:L28
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L37
- 方法名:createBodyLayer
- 源码定位:L37
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(WitchRenderState state) @ L70
- 方法名:setupAnim
- 源码定位:L70
- 返回类型:void
- 修饰符:public
参数:
- state: WitchRenderState
说明:
TODO
public ModelPart getNose() @ L85
- 方法名:getNose
- 源码定位:L85
- 返回类型:ModelPart
- 修饰符:public
参数:
- 无
说明:
TODO
public ModelPart getHead() @ L89
- 方法名:getHead
- 源码定位:L89
- 返回类型:ModelPart
- 修饰符:public
参数:
- 无
说明:
TODO
public void translateToArms(WitchRenderState state, PoseStack outputPoseStack) @ L94
- 方法名:translateToArms
- 源码定位:L94
- 返回类型:void
- 修饰符:public
参数:
- state: WitchRenderState
- outputPoseStack: PoseStack
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class WitchModel extends EntityModel<WitchRenderState> implements HeadedModel, VillagerLikeModel<WitchRenderState> {
protected final ModelPart nose;
private final ModelPart head;
private final ModelPart rightLeg;
private final ModelPart leftLeg;
private final ModelPart arms;
public WitchModel(ModelPart root) {
super(root);
this.head = root.getChild("head");
this.nose = this.head.getChild("nose");
this.rightLeg = root.getChild("right_leg");
this.leftLeg = root.getChild("left_leg");
this.arms = root.getChild("arms");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition mesh = VillagerModel.createBodyModel();
PartDefinition root = mesh.getRoot();
PartDefinition head = root.addOrReplaceChild(
"head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F), PartPose.ZERO
);
PartDefinition hat = head.addOrReplaceChild(
"hat", CubeListBuilder.create().texOffs(0, 64).addBox(0.0F, 0.0F, 0.0F, 10.0F, 2.0F, 10.0F), PartPose.offset(-5.0F, -10.03125F, -5.0F)
);
PartDefinition hat2 = hat.addOrReplaceChild(
"hat2",
CubeListBuilder.create().texOffs(0, 76).addBox(0.0F, 0.0F, 0.0F, 7.0F, 4.0F, 7.0F),
PartPose.offsetAndRotation(1.75F, -4.0F, 2.0F, -0.05235988F, 0.0F, 0.02617994F)
);
PartDefinition hat3 = hat2.addOrReplaceChild(
"hat3",
CubeListBuilder.create().texOffs(0, 87).addBox(0.0F, 0.0F, 0.0F, 4.0F, 4.0F, 4.0F),
PartPose.offsetAndRotation(1.75F, -4.0F, 2.0F, -0.10471976F, 0.0F, 0.05235988F)
);
hat3.addOrReplaceChild(
"hat4",
CubeListBuilder.create().texOffs(0, 95).addBox(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F, new CubeDeformation(0.25F)),
PartPose.offsetAndRotation(1.75F, -2.0F, 2.0F, (float) (-Math.PI / 15), 0.0F, 0.10471976F)
);
PartDefinition nose = head.getChild("nose");
nose.addOrReplaceChild(
"mole",
CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, 3.0F, -6.75F, 1.0F, 1.0F, 1.0F, new CubeDeformation(-0.25F)),
PartPose.offset(0.0F, -2.0F, 0.0F)
);
return LayerDefinition.create(mesh, 64, 128);
}
public void setupAnim(WitchRenderState state) {
super.setupAnim(state);
this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
this.rightLeg.xRot = Mth.cos(state.walkAnimationPos * 0.6662F) * 1.4F * state.walkAnimationSpeed * 0.5F;
this.leftLeg.xRot = Mth.cos(state.walkAnimationPos * 0.6662F + (float) Math.PI) * 1.4F * state.walkAnimationSpeed * 0.5F;
float speed = 0.01F * (state.entityId % 10);
this.nose.xRot = Mth.sin(state.ageInTicks * speed) * 4.5F * (float) (Math.PI / 180.0);
this.nose.zRot = Mth.cos(state.ageInTicks * speed) * 2.5F * (float) (Math.PI / 180.0);
if (state.isHoldingItem) {
this.nose.setPos(0.0F, 1.0F, -1.5F);
this.nose.xRot = -0.9F;
}
}
public ModelPart getNose() {
return this.nose;
}
@Override
public ModelPart getHead() {
return this.head;
}
public void translateToArms(WitchRenderState state, PoseStack outputPoseStack) {
this.root.translateAndRotate(outputPoseStack);
this.arms.translateAndRotate(outputPoseStack);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset(), PartPose.offsetAndRotation()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
CubeDeformation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
VillagerModel.createBodyModel()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.cos(), Mth.sin()
- 引用位置: