IllagerModel.java
net.minecraft.client.model.monster.illager.IllagerModel
信息
- 全限定名:net.minecraft.client.model.monster.illager.IllagerModel
- 类型:public class
- 包:net.minecraft.client.model.monster.illager
- 源码路径:src/main/java/net/minecraft/client/model/monster/illager/IllagerModel.java
- 起始行号:L23
- 继承:EntityModel
- 实现:ArmedModel
, HeadedModel - 职责:
TODO
字段/常量
-
head- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
hat- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L25 - 说明:
TODO
- 类型:
-
arms- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L26 - 说明:
TODO
- 类型:
-
leftLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L27 - 说明:
TODO
- 类型:
-
rightLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L28 - 说明:
TODO
- 类型:
-
rightArm- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L29 - 说明:
TODO
- 类型:
-
leftArm- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L30 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public IllagerModel(ModelPart root) @ L32
- 构造器名:IllagerModel
- 源码定位:L32
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L44
- 方法名:createBodyLayer
- 源码定位:L44
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(S state) @ L86
- 方法名:setupAnim
- 源码定位:L86
- 返回类型:void
- 修饰符:public
参数:
- state: S
说明:
TODO
private ModelPart getArm(HumanoidArm arm) @ L167
- 方法名:getArm
- 源码定位:L167
- 返回类型:ModelPart
- 修饰符:private
参数:
- arm: HumanoidArm
说明:
TODO
public ModelPart getHat() @ L171
- 方法名:getHat
- 源码定位:L171
- 返回类型:ModelPart
- 修饰符:public
参数:
- 无
说明:
TODO
public ModelPart getHead() @ L175
- 方法名:getHead
- 源码定位:L175
- 返回类型:ModelPart
- 修饰符:public
参数:
- 无
说明:
TODO
public void translateToHand(IllagerRenderState state, HumanoidArm arm, PoseStack poseStack) @ L180
- 方法名:translateToHand
- 源码定位:L180
- 返回类型:void
- 修饰符:public
参数:
- state: IllagerRenderState
- arm: HumanoidArm
- poseStack: PoseStack
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class IllagerModel<S extends IllagerRenderState> extends EntityModel<S> implements ArmedModel<S>, HeadedModel {
private final ModelPart head;
private final ModelPart hat;
private final ModelPart arms;
private final ModelPart leftLeg;
private final ModelPart rightLeg;
private final ModelPart rightArm;
private final ModelPart leftArm;
public IllagerModel(ModelPart root) {
super(root);
this.head = root.getChild("head");
this.hat = this.head.getChild("hat");
this.hat.visible = false;
this.arms = root.getChild("arms");
this.leftLeg = root.getChild("left_leg");
this.rightLeg = root.getChild("right_leg");
this.leftArm = root.getChild("left_arm");
this.rightArm = root.getChild("right_arm");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition mesh = new MeshDefinition();
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.offset(0.0F, 0.0F, 0.0F)
);
head.addOrReplaceChild(
"hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 12.0F, 8.0F, new CubeDeformation(0.45F)), PartPose.ZERO
);
head.addOrReplaceChild(
"nose", CubeListBuilder.create().texOffs(24, 0).addBox(-1.0F, -1.0F, -6.0F, 2.0F, 4.0F, 2.0F), PartPose.offset(0.0F, -2.0F, 0.0F)
);
root.addOrReplaceChild(
"body",
CubeListBuilder.create()
.texOffs(16, 20)
.addBox(-4.0F, 0.0F, -3.0F, 8.0F, 12.0F, 6.0F)
.texOffs(0, 38)
.addBox(-4.0F, 0.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.5F)),
PartPose.offset(0.0F, 0.0F, 0.0F)
);
PartDefinition arms = root.addOrReplaceChild(
"arms",
CubeListBuilder.create().texOffs(44, 22).addBox(-8.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F).texOffs(40, 38).addBox(-4.0F, 2.0F, -2.0F, 8.0F, 4.0F, 4.0F),
PartPose.offsetAndRotation(0.0F, 3.0F, -1.0F, -0.75F, 0.0F, 0.0F)
);
arms.addOrReplaceChild("left_shoulder", CubeListBuilder.create().texOffs(44, 22).mirror().addBox(4.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F), PartPose.ZERO);
root.addOrReplaceChild(
"right_leg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(-2.0F, 12.0F, 0.0F)
);
root.addOrReplaceChild(
"left_leg", CubeListBuilder.create().texOffs(0, 22).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(2.0F, 12.0F, 0.0F)
);
root.addOrReplaceChild(
"right_arm", CubeListBuilder.create().texOffs(40, 46).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(-5.0F, 2.0F, 0.0F)
);
root.addOrReplaceChild(
"left_arm", CubeListBuilder.create().texOffs(40, 46).mirror().addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(5.0F, 2.0F, 0.0F)
);
return LayerDefinition.create(mesh, 64, 64);
}
public void setupAnim(S state) {
super.setupAnim(state);
this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
if (state.isRiding) {
this.rightArm.xRot = (float) (-Math.PI / 5);
this.rightArm.yRot = 0.0F;
this.rightArm.zRot = 0.0F;
this.leftArm.xRot = (float) (-Math.PI / 5);
this.leftArm.yRot = 0.0F;
this.leftArm.zRot = 0.0F;
this.rightLeg.xRot = -1.4137167F;
this.rightLeg.yRot = (float) (Math.PI / 10);
this.rightLeg.zRot = 0.07853982F;
this.leftLeg.xRot = -1.4137167F;
this.leftLeg.yRot = (float) (-Math.PI / 10);
this.leftLeg.zRot = -0.07853982F;
} else {
float animationSpeed = state.walkAnimationSpeed;
float animationPos = state.walkAnimationPos;
this.rightArm.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * 2.0F * animationSpeed * 0.5F;
this.rightArm.yRot = 0.0F;
this.rightArm.zRot = 0.0F;
this.leftArm.xRot = Mth.cos(animationPos * 0.6662F) * 2.0F * animationSpeed * 0.5F;
this.leftArm.yRot = 0.0F;
this.leftArm.zRot = 0.0F;
this.rightLeg.xRot = Mth.cos(animationPos * 0.6662F) * 1.4F * animationSpeed * 0.5F;
this.rightLeg.yRot = 0.0F;
this.rightLeg.zRot = 0.0F;
this.leftLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * 1.4F * animationSpeed * 0.5F;
this.leftLeg.yRot = 0.0F;
this.leftLeg.zRot = 0.0F;
}
AbstractIllager.IllagerArmPose pose = state.armPose;
if (pose == AbstractIllager.IllagerArmPose.ATTACKING) {
if (state.getMainHandItemState().isEmpty()) {
AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, true, state);
} else {
AnimationUtils.swingWeaponDown(this.rightArm, this.leftArm, state.mainArm, state.attackAnim, state.ageInTicks);
}
} else if (pose == AbstractIllager.IllagerArmPose.SPELLCASTING) {
this.rightArm.z = 0.0F;
this.rightArm.x = -5.0F;
this.leftArm.z = 0.0F;
this.leftArm.x = 5.0F;
this.rightArm.xRot = Mth.cos(state.ageInTicks * 0.6662F) * 0.25F;
this.leftArm.xRot = Mth.cos(state.ageInTicks * 0.6662F) * 0.25F;
this.rightArm.zRot = (float) (Math.PI * 3.0 / 4.0);
this.leftArm.zRot = (float) (-Math.PI * 3.0 / 4.0);
this.rightArm.yRot = 0.0F;
this.leftArm.yRot = 0.0F;
} else if (pose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) {
this.rightArm.yRot = -0.1F + this.head.yRot;
this.rightArm.xRot = (float) (-Math.PI / 2) + this.head.xRot;
this.leftArm.xRot = -0.9424779F + this.head.xRot;
this.leftArm.yRot = this.head.yRot - 0.4F;
this.leftArm.zRot = (float) (Math.PI / 2);
} else if (pose == AbstractIllager.IllagerArmPose.CROSSBOW_HOLD) {
AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, true);
} else if (pose == AbstractIllager.IllagerArmPose.CROSSBOW_CHARGE) {
AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, state.maxCrossbowChargeDuration, state.ticksUsingItem, true);
} else if (pose == AbstractIllager.IllagerArmPose.CELEBRATING) {
this.rightArm.z = 0.0F;
this.rightArm.x = -5.0F;
this.rightArm.xRot = Mth.cos(state.ageInTicks * 0.6662F) * 0.05F;
this.rightArm.zRot = 2.670354F;
this.rightArm.yRot = 0.0F;
this.leftArm.z = 0.0F;
this.leftArm.x = 5.0F;
this.leftArm.xRot = Mth.cos(state.ageInTicks * 0.6662F) * 0.05F;
this.leftArm.zRot = (float) (-Math.PI * 3.0 / 4.0);
this.leftArm.yRot = 0.0F;
}
boolean crossedArms = pose == AbstractIllager.IllagerArmPose.CROSSED;
this.arms.visible = crossedArms;
this.leftArm.visible = !crossedArms;
this.rightArm.visible = !crossedArms;
}
private ModelPart getArm(HumanoidArm arm) {
return arm == HumanoidArm.LEFT ? this.leftArm : this.rightArm;
}
public ModelPart getHat() {
return this.hat;
}
@Override
public ModelPart getHead() {
return this.head;
}
public void translateToHand(IllagerRenderState state, HumanoidArm arm, PoseStack poseStack) {
this.root.translateAndRotate(poseStack);
this.getArm(arm).translateAndRotate(poseStack);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
AnimationUtils.animateCrossbowCharge(), AnimationUtils.animateCrossbowHold(), AnimationUtils.animateZombieArms(), AnimationUtils.swingWeaponDown()
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset(), PartPose.offsetAndRotation()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
CubeDeformation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.cos()
- 引用位置:
-
- 引用位置:
参数
- 引用位置: