VexModel.java
net.minecraft.client.model.monster.vex.VexModel
信息
- 全限定名:net.minecraft.client.model.monster.vex.VexModel
- 类型:public class
- 包:net.minecraft.client.model.monster.vex
- 源码路径:src/main/java/net/minecraft/client/model/monster/vex/VexModel.java
- 起始行号:L21
- 继承:EntityModel
- 实现:ArmedModel
- 职责:
TODO
字段/常量
-
body- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
rightArm- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
leftArm- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
rightWing- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L25 - 说明:
TODO
- 类型:
-
leftWing- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L26 - 说明:
TODO
- 类型:
-
head- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L27 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public VexModel(ModelPart root) @ L29
- 构造器名:VexModel
- 源码定位:L29
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L33
- 方法名:createBodyLayer
- 源码定位:L33
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(VexRenderState state) @ L74
- 方法名:setupAnim
- 源码定位:L74
- 返回类型:void
- 修饰符:public
参数:
- state: VexRenderState
说明:
TODO
private void setArmsCharging(boolean hasItemInRightHand, boolean hasItemInLeftHand, float movingArmZBob) @ L96
- 方法名:setArmsCharging
- 源码定位:L96
- 返回类型:void
- 修饰符:private
参数:
- hasItemInRightHand: boolean
- hasItemInLeftHand: boolean
- movingArmZBob: float
说明:
TODO
public void translateToHand(VexRenderState state, HumanoidArm arm, PoseStack poseStack) @ L119
- 方法名:translateToHand
- 源码定位:L119
- 返回类型:void
- 修饰符:public
参数:
- state: VexRenderState
- arm: HumanoidArm
- poseStack: PoseStack
说明:
TODO
private void offsetStackPosition(PoseStack poseStack, boolean mainArm) @ L129
- 方法名:offsetStackPosition
- 源码定位:L129
- 返回类型:void
- 修饰符:private
参数:
- poseStack: PoseStack
- mainArm: boolean
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class VexModel extends EntityModel<VexRenderState> implements ArmedModel<VexRenderState> {
private final ModelPart body = this.root.getChild("body");
private final ModelPart rightArm = this.body.getChild("right_arm");
private final ModelPart leftArm = this.body.getChild("left_arm");
private final ModelPart rightWing = this.body.getChild("right_wing");
private final ModelPart leftWing = this.body.getChild("left_wing");
private final ModelPart head = this.root.getChild("head");
public VexModel(ModelPart root) {
super(root.getChild("root"), RenderTypes::entityTranslucent);
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, -2.5F, 0.0F));
root.addOrReplaceChild(
"head",
CubeListBuilder.create().texOffs(0, 0).addBox(-2.5F, -5.0F, -2.5F, 5.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)),
PartPose.offset(0.0F, 20.0F, 0.0F)
);
PartDefinition body = root.addOrReplaceChild(
"body",
CubeListBuilder.create()
.texOffs(0, 10)
.addBox(-1.5F, 0.0F, -1.0F, 3.0F, 4.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 16)
.addBox(-1.5F, 1.0F, -1.0F, 3.0F, 5.0F, 2.0F, new CubeDeformation(-0.2F)),
PartPose.offset(0.0F, 20.0F, 0.0F)
);
body.addOrReplaceChild(
"right_arm",
CubeListBuilder.create().texOffs(23, 0).addBox(-1.25F, -0.5F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(-0.1F)),
PartPose.offset(-1.75F, 0.25F, 0.0F)
);
body.addOrReplaceChild(
"left_arm",
CubeListBuilder.create().texOffs(23, 6).addBox(-0.75F, -0.5F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(-0.1F)),
PartPose.offset(1.75F, 0.25F, 0.0F)
);
body.addOrReplaceChild(
"left_wing",
CubeListBuilder.create().texOffs(16, 14).mirror().addBox(0.0F, 0.0F, 0.0F, 0.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)).mirror(false),
PartPose.offset(0.5F, 1.0F, 1.0F)
);
body.addOrReplaceChild(
"right_wing",
CubeListBuilder.create().texOffs(16, 14).addBox(0.0F, 0.0F, 0.0F, 0.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)),
PartPose.offset(-0.5F, 1.0F, 1.0F)
);
return LayerDefinition.create(meshdefinition, 32, 32);
}
public void setupAnim(VexRenderState state) {
super.setupAnim(state);
this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
float movingArmZBob = Mth.cos(state.ageInTicks * 5.5F * (float) (Math.PI / 180.0)) * 0.1F;
this.rightArm.zRot = (float) (Math.PI / 5) + movingArmZBob;
this.leftArm.zRot = -((float) (Math.PI / 5) + movingArmZBob);
if (state.isCharging) {
this.body.xRot = 0.0F;
this.setArmsCharging(!state.rightHandItemState.isEmpty(), !state.leftHandItemState.isEmpty(), movingArmZBob);
} else {
this.body.xRot = (float) (Math.PI / 20);
}
this.leftWing.yRot = 1.0995574F + Mth.cos(state.ageInTicks * 45.836624F * (float) (Math.PI / 180.0)) * (float) (Math.PI / 180.0) * 16.2F;
this.rightWing.yRot = -this.leftWing.yRot;
this.leftWing.xRot = 0.47123888F;
this.leftWing.zRot = -0.47123888F;
this.rightWing.xRot = 0.47123888F;
this.rightWing.zRot = 0.47123888F;
}
private void setArmsCharging(boolean hasItemInRightHand, boolean hasItemInLeftHand, float movingArmZBob) {
if (!hasItemInRightHand && !hasItemInLeftHand) {
this.rightArm.xRot = -1.2217305F;
this.rightArm.yRot = (float) (Math.PI / 12);
this.rightArm.zRot = -0.47123888F - movingArmZBob;
this.leftArm.xRot = -1.2217305F;
this.leftArm.yRot = (float) (-Math.PI / 12);
this.leftArm.zRot = 0.47123888F + movingArmZBob;
} else {
if (hasItemInRightHand) {
this.rightArm.xRot = (float) (Math.PI * 7.0 / 6.0);
this.rightArm.yRot = (float) (Math.PI / 12);
this.rightArm.zRot = -0.47123888F - movingArmZBob;
}
if (hasItemInLeftHand) {
this.leftArm.xRot = (float) (Math.PI * 7.0 / 6.0);
this.leftArm.yRot = (float) (-Math.PI / 12);
this.leftArm.zRot = 0.47123888F + movingArmZBob;
}
}
}
public void translateToHand(VexRenderState state, HumanoidArm arm, PoseStack poseStack) {
boolean mainArm = arm == HumanoidArm.RIGHT;
ModelPart activeArm = mainArm ? this.rightArm : this.leftArm;
this.root.translateAndRotate(poseStack);
this.body.translateAndRotate(poseStack);
activeArm.translateAndRotate(poseStack);
poseStack.scale(0.55F, 0.55F, 0.55F);
this.offsetStackPosition(poseStack, mainArm);
}
private void offsetStackPosition(PoseStack poseStack, boolean mainArm) {
if (mainArm) {
poseStack.translate(0.046875, -0.15625, 0.078125);
} else {
poseStack.translate(-0.046875, -0.15625, 0.078125);
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
CubeDeformation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.cos()
- 引用位置:
-
- 引用位置:
参数
- 引用位置: