PandaModel.java
net.minecraft.client.model.animal.panda.PandaModel
信息
- 全限定名:net.minecraft.client.model.animal.panda.PandaModel
- 类型:public class
- 包:net.minecraft.client.model.animal.panda
- 源码路径:src/main/java/net/minecraft/client/model/animal/panda/PandaModel.java
- 起始行号:L16
- 继承:QuadrupedModel
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
public PandaModel(ModelPart root) @ L17
- 构造器名:PandaModel
- 源码定位:L17
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L21
- 方法名:createBodyLayer
- 源码定位:L21
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(PandaRenderState state) @ L52
- 方法名:setupAnim
- 源码定位:L52
- 返回类型:void
- 修饰符:public
参数:
- state: PandaRenderState
说明:
TODO
protected void animateSitting(PandaRenderState state) @ L109
- 方法名:animateSitting
- 源码定位:L109
- 返回类型:void
- 修饰符:protected
参数:
- state: PandaRenderState
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class PandaModel extends QuadrupedModel<PandaRenderState> {
public PandaModel(ModelPart root) {
super(root);
}
public static LayerDefinition createBodyLayer() {
MeshDefinition mesh = new MeshDefinition();
PartDefinition root = mesh.getRoot();
root.addOrReplaceChild(
"head",
CubeListBuilder.create()
.texOffs(0, 6)
.addBox(-6.5F, -5.0F, -4.0F, 13.0F, 10.0F, 9.0F)
.texOffs(45, 16)
.addBox("nose", -3.5F, 0.0F, -6.0F, 7.0F, 5.0F, 2.0F)
.texOffs(52, 25)
.addBox("left_ear", 3.5F, -8.0F, -1.0F, 5.0F, 4.0F, 1.0F)
.texOffs(52, 25)
.addBox("right_ear", -8.5F, -8.0F, -1.0F, 5.0F, 4.0F, 1.0F),
PartPose.offset(0.0F, 11.5F, -17.0F)
);
root.addOrReplaceChild(
"body",
CubeListBuilder.create().texOffs(0, 25).addBox(-9.5F, -13.0F, -6.5F, 19.0F, 26.0F, 13.0F),
PartPose.offsetAndRotation(0.0F, 10.0F, 0.0F, (float) (Math.PI / 2), 0.0F, 0.0F)
);
int legH = 9;
int legW = 6;
CubeListBuilder leg = CubeListBuilder.create().texOffs(40, 0).addBox(-3.0F, 0.0F, -3.0F, 6.0F, 9.0F, 6.0F);
root.addOrReplaceChild("right_hind_leg", leg, PartPose.offset(-5.5F, 15.0F, 9.0F));
root.addOrReplaceChild("left_hind_leg", leg, PartPose.offset(5.5F, 15.0F, 9.0F));
root.addOrReplaceChild("right_front_leg", leg, PartPose.offset(-5.5F, 15.0F, -9.0F));
root.addOrReplaceChild("left_front_leg", leg, PartPose.offset(5.5F, 15.0F, -9.0F));
return LayerDefinition.create(mesh, 64, 64);
}
public void setupAnim(PandaRenderState state) {
super.setupAnim(state);
if (state.isUnhappy) {
this.head.yRot = 0.35F * Mth.sin(0.6F * state.ageInTicks);
this.head.zRot = 0.35F * Mth.sin(0.6F * state.ageInTicks);
this.rightFrontLeg.xRot = -0.75F * Mth.sin(0.3F * state.ageInTicks);
this.leftFrontLeg.xRot = 0.75F * Mth.sin(0.3F * state.ageInTicks);
} else {
this.head.zRot = 0.0F;
}
if (state.isSneezing) {
if (state.sneezeTime < 15) {
this.head.xRot = (float) (-Math.PI / 4) * state.sneezeTime / 14.0F;
} else if (state.sneezeTime < 20) {
float internalSneezePos = (state.sneezeTime - 15) / 5;
this.head.xRot = (float) (-Math.PI / 4) + (float) (Math.PI / 4) * internalSneezePos;
}
}
if (state.sitAmount > 0.0F) {
this.animateSitting(state);
if (state.isEating) {
this.head.xRot = (float) (Math.PI / 2) + 0.2F * Mth.sin(state.ageInTicks * 0.6F);
this.rightFrontLeg.xRot = -0.4F - 0.2F * Mth.sin(state.ageInTicks * 0.6F);
this.leftFrontLeg.xRot = -0.4F - 0.2F * Mth.sin(state.ageInTicks * 0.6F);
}
if (state.isScared) {
this.head.xRot = 2.1707964F;
this.rightFrontLeg.xRot = -0.9F;
this.leftFrontLeg.xRot = -0.9F;
}
} else {
this.rightHindLeg.zRot = 0.0F;
this.leftHindLeg.zRot = 0.0F;
this.rightFrontLeg.zRot = 0.0F;
this.leftFrontLeg.zRot = 0.0F;
}
if (state.lieOnBackAmount > 0.0F) {
this.rightHindLeg.xRot = -0.6F * Mth.sin(state.ageInTicks * 0.15F);
this.leftHindLeg.xRot = 0.6F * Mth.sin(state.ageInTicks * 0.15F);
this.rightFrontLeg.xRot = 0.3F * Mth.sin(state.ageInTicks * 0.25F);
this.leftFrontLeg.xRot = -0.3F * Mth.sin(state.ageInTicks * 0.25F);
this.head.xRot = Mth.rotLerpRad(state.lieOnBackAmount, this.head.xRot, (float) (Math.PI / 2));
}
if (state.rollAmount > 0.0F) {
this.head.xRot = Mth.rotLerpRad(state.rollAmount, this.head.xRot, 2.0561945F);
this.rightHindLeg.xRot = -0.5F * Mth.sin(state.ageInTicks * 0.5F);
this.leftHindLeg.xRot = 0.5F * Mth.sin(state.ageInTicks * 0.5F);
this.rightFrontLeg.xRot = 0.5F * Mth.sin(state.ageInTicks * 0.5F);
this.leftFrontLeg.xRot = -0.5F * Mth.sin(state.ageInTicks * 0.5F);
}
}
protected void animateSitting(PandaRenderState state) {
this.body.xRot = Mth.rotLerpRad(state.sitAmount, this.body.xRot, 1.7407963F);
this.head.xRot = Mth.rotLerpRad(state.sitAmount, this.head.xRot, (float) (Math.PI / 2));
this.rightFrontLeg.zRot = -0.27079642F;
this.leftFrontLeg.zRot = 0.27079642F;
this.rightHindLeg.zRot = 0.5707964F;
this.leftHindLeg.zRot = -0.5707964F;
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset(), PartPose.offsetAndRotation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.rotLerpRad(), Mth.sin()
- 引用位置: