RavagerModel.java
net.minecraft.client.model.monster.ravager.RavagerModel
信息
- 全限定名:net.minecraft.client.model.monster.ravager.RavagerModel
- 类型:public class
- 包:net.minecraft.client.model.monster.ravager
- 源码路径:src/main/java/net/minecraft/client/model/monster/ravager/RavagerModel.java
- 起始行号:L16
- 继承:EntityModel
- 职责:
TODO
字段/常量
-
head- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
mouth- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
rightHindLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
leftHindLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
rightFrontLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
leftFrontLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
neck- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public RavagerModel(ModelPart root) @ L25
- 构造器名:RavagerModel
- 源码定位:L25
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L36
- 方法名:createBodyLayer
- 源码定位:L36
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(RavagerRenderState state) @ L93
- 方法名:setupAnim
- 源码定位:L93
- 返回类型:void
- 修饰符:public
参数:
- state: RavagerRenderState
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class RavagerModel extends EntityModel<RavagerRenderState> {
private final ModelPart head;
private final ModelPart mouth;
private final ModelPart rightHindLeg;
private final ModelPart leftHindLeg;
private final ModelPart rightFrontLeg;
private final ModelPart leftFrontLeg;
private final ModelPart neck;
public RavagerModel(ModelPart root) {
super(root);
this.neck = root.getChild("neck");
this.head = this.neck.getChild("head");
this.mouth = this.head.getChild("mouth");
this.rightHindLeg = root.getChild("right_hind_leg");
this.leftHindLeg = root.getChild("left_hind_leg");
this.rightFrontLeg = root.getChild("right_front_leg");
this.leftFrontLeg = root.getChild("left_front_leg");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition mesh = new MeshDefinition();
PartDefinition root = mesh.getRoot();
int legSize = 16;
PartDefinition neck = root.addOrReplaceChild(
"neck", CubeListBuilder.create().texOffs(68, 73).addBox(-5.0F, -1.0F, -18.0F, 10.0F, 10.0F, 18.0F), PartPose.offset(0.0F, -7.0F, 5.5F)
);
PartDefinition head = neck.addOrReplaceChild(
"head",
CubeListBuilder.create()
.texOffs(0, 0)
.addBox(-8.0F, -20.0F, -14.0F, 16.0F, 20.0F, 16.0F)
.texOffs(0, 0)
.addBox(-2.0F, -6.0F, -18.0F, 4.0F, 8.0F, 4.0F),
PartPose.offset(0.0F, 16.0F, -17.0F)
);
head.addOrReplaceChild(
"right_horn",
CubeListBuilder.create().texOffs(74, 55).addBox(0.0F, -14.0F, -2.0F, 2.0F, 14.0F, 4.0F),
PartPose.offsetAndRotation(-10.0F, -14.0F, -8.0F, 1.0995574F, 0.0F, 0.0F)
);
head.addOrReplaceChild(
"left_horn",
CubeListBuilder.create().texOffs(74, 55).mirror().addBox(0.0F, -14.0F, -2.0F, 2.0F, 14.0F, 4.0F),
PartPose.offsetAndRotation(8.0F, -14.0F, -8.0F, 1.0995574F, 0.0F, 0.0F)
);
head.addOrReplaceChild(
"mouth", CubeListBuilder.create().texOffs(0, 36).addBox(-8.0F, 0.0F, -16.0F, 16.0F, 3.0F, 16.0F), PartPose.offset(0.0F, -2.0F, 2.0F)
);
root.addOrReplaceChild(
"body",
CubeListBuilder.create()
.texOffs(0, 55)
.addBox(-7.0F, -10.0F, -7.0F, 14.0F, 16.0F, 20.0F)
.texOffs(0, 91)
.addBox(-6.0F, 6.0F, -7.0F, 12.0F, 13.0F, 18.0F),
PartPose.offsetAndRotation(0.0F, 1.0F, 2.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
);
root.addOrReplaceChild(
"right_hind_leg", CubeListBuilder.create().texOffs(96, 0).addBox(-4.0F, 0.0F, -4.0F, 8.0F, 37.0F, 8.0F), PartPose.offset(-8.0F, -13.0F, 18.0F)
);
root.addOrReplaceChild(
"left_hind_leg",
CubeListBuilder.create().texOffs(96, 0).mirror().addBox(-4.0F, 0.0F, -4.0F, 8.0F, 37.0F, 8.0F),
PartPose.offset(8.0F, -13.0F, 18.0F)
);
root.addOrReplaceChild(
"right_front_leg", CubeListBuilder.create().texOffs(64, 0).addBox(-4.0F, 0.0F, -4.0F, 8.0F, 37.0F, 8.0F), PartPose.offset(-8.0F, -13.0F, -5.0F)
);
root.addOrReplaceChild(
"left_front_leg",
CubeListBuilder.create().texOffs(64, 0).mirror().addBox(-4.0F, 0.0F, -4.0F, 8.0F, 37.0F, 8.0F),
PartPose.offset(8.0F, -13.0F, -5.0F)
);
return LayerDefinition.create(mesh, 128, 128);
}
public void setupAnim(RavagerRenderState state) {
super.setupAnim(state);
float stunnedTick = state.stunnedTicksRemaining;
float attackTick = state.attackTicksRemaining;
int attackTime = 10;
if (attackTick > 0.0F) {
float headAnim = Mth.triangleWave(attackTick, 10.0F);
float scaled = (1.0F + headAnim) * 0.5F;
float headPos = scaled * scaled * scaled * 12.0F;
float yOffset = headPos * Mth.sin(this.neck.xRot);
this.neck.z = -6.5F + headPos;
this.neck.y = -7.0F - yOffset;
if (attackTick > 5.0F) {
this.mouth.xRot = Mth.sin((-4.0F + attackTick) / 4.0F) * (float) Math.PI * 0.4F;
} else {
this.mouth.xRot = (float) (Math.PI / 20) * Mth.sin((float) Math.PI * attackTick / 10.0F);
}
} else {
float headPos = -1.0F;
float yOffset = -1.0F * Mth.sin(this.neck.xRot);
this.neck.x = 0.0F;
this.neck.y = -7.0F - yOffset;
this.neck.z = 5.5F;
boolean isStunned = stunnedTick > 0.0F;
this.neck.xRot = isStunned ? 0.21991149F : 0.0F;
this.mouth.xRot = (float) Math.PI * (isStunned ? 0.05F : 0.01F);
if (isStunned) {
double speed = stunnedTick / 40.0;
this.neck.x = (float)Math.sin(speed * 10.0) * 3.0F;
} else if (state.roarAnimation > 0.0) {
float mouthAnim = Mth.sin(state.roarAnimation * (float) Math.PI * 0.25F);
this.mouth.xRot = (float) (Math.PI / 2) * mouthAnim;
}
}
this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
float animationPos = state.walkAnimationPos;
float legRot = 0.4F * state.walkAnimationSpeed;
this.rightHindLeg.xRot = Mth.cos(animationPos * 0.6662F) * legRot;
this.leftHindLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * legRot;
this.rightFrontLeg.xRot = Mth.cos(animationPos * 0.6662F + (float) Math.PI) * legRot;
this.leftFrontLeg.xRot = Mth.cos(animationPos * 0.6662F) * legRot;
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset(), PartPose.offsetAndRotation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.cos(), Mth.sin(), Mth.triangleWave()
- 引用位置: