BabyDonkeyModel.java
net.minecraft.client.model.animal.equine.BabyDonkeyModel
信息
- 全限定名:net.minecraft.client.model.animal.equine.BabyDonkeyModel
- 类型:public class
- 包:net.minecraft.client.model.animal.equine
- 源码路径:src/main/java/net/minecraft/client/model/animal/equine/BabyDonkeyModel.java
- 起始行号:L16
- 继承:DonkeyModel
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
public BabyDonkeyModel(ModelPart root) @ L17
- 构造器名:BabyDonkeyModel
- 源码定位:L17
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBabyLayer() @ L28
- 方法名:createBabyLayer
- 源码定位:L28
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(DonkeyRenderState state) @ L89
- 方法名:setupAnim
- 源码定位:L89
- 返回类型:void
- 修饰符:public
参数:
- state: DonkeyRenderState
说明:
TODO
protected void offsetLegPositionWhenStanding(float standing) @ L103
- 方法名:offsetLegPositionWhenStanding
- 源码定位:L103
- 返回类型:void
- 修饰符:protected
参数:
- standing: float
说明:
TODO
protected float getLegStandAngle() @ L109
- 方法名:getLegStandAngle
- 源码定位:L109
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getLegStandingYOffset() @ L114
- 方法名:getLegStandingYOffset
- 源码定位:L114
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getLegStandingZOffset() @ L119
- 方法名:getLegStandingZOffset
- 源码定位:L119
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getLegStandingXRotOffset() @ L124
- 方法名:getLegStandingXRotOffset
- 源码定位:L124
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getTailXRotOffset() @ L129
- 方法名:getTailXRotOffset
- 源码定位:L129
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected void animateHeadPartsPlacement(float eating, float standing) @ L134
- 方法名:animateHeadPartsPlacement
- 源码定位:L134
- 返回类型:void
- 修饰符:protected
参数:
- eating: float
- standing: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class BabyDonkeyModel extends DonkeyModel {
public BabyDonkeyModel(ModelPart root) {
ModelPart body = root.getChild("body");
ModelPart rightHindLeg = body.getChild("right_hind_leg");
ModelPart leftHindLeg = body.getChild("left_hind_leg");
ModelPart rightFrontLeg = body.getChild("right_front_leg");
ModelPart leftFrontLeg = body.getChild("left_front_leg");
ModelPart headParts = body.getChild("head_parts");
ModelPart tail = body.getChild("tail");
super(root, headParts, rightHindLeg, rightFrontLeg, leftHindLeg, leftFrontLeg, tail);
}
public static LayerDefinition createBabyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition body = partdefinition.addOrReplaceChild(
"body",
CubeListBuilder.create().texOffs(0, 13).addBox(-5.0F, -3.0F, -7.0F, 8.0F, 6.0F, 14.0F, new CubeDeformation(0.0F)),
PartPose.offset(1.0F, 14.0F, 0.0F)
);
PartDefinition tail = body.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offset(0.0F, -1.5F, 6.5F));
tail.addOrReplaceChild(
"tail_r1",
CubeListBuilder.create().texOffs(24, 33).addBox(-2.5F, -1.0F, -0.5F, 3.0F, 3.0F, 8.0F, new CubeDeformation(0.0F)),
PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.7418F, 0.0F, 0.0F)
);
body.addOrReplaceChild(
"left_hind_leg",
CubeListBuilder.create().texOffs(12, 44).addBox(-2.5F, -1.5F, -1.5F, 3.0F, 8.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(2.25F, 3.5F, 5.25F)
);
body.addOrReplaceChild(
"right_hind_leg",
CubeListBuilder.create().texOffs(0, 44).addBox(-2.5F, -1.5F, -1.5F, 3.0F, 8.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(-2.4F, 3.5F, 5.4F)
);
body.addOrReplaceChild(
"left_front_leg",
CubeListBuilder.create().texOffs(12, 33).addBox(-2.5F, -1.5F, -1.5F, 3.0F, 8.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(2.4F, 3.5F, -5.3F)
);
body.addOrReplaceChild(
"right_front_leg",
CubeListBuilder.create().texOffs(0, 33).addBox(-2.5F, -1.5F, -1.5F, 3.0F, 8.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(-2.4F, 3.5F, -5.4F)
);
PartDefinition neck = body.addOrReplaceChild("head_parts", CubeListBuilder.create(), PartPose.offset(0.0F, -3.0F, -5.0F));
neck.addOrReplaceChild(
"neck_r1",
CubeListBuilder.create().texOffs(30, 9).addBox(-3.0F, -6.0F, -3.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.0F)),
PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.3927F, 0.0F, 0.0F)
);
PartDefinition head = neck.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.offset(0.0F, -5.0F, -3.0F));
head.addOrReplaceChild(
"head_r1",
CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -3.6F, -8.4F, 6.0F, 4.0F, 9.0F, new CubeDeformation(0.0F)),
PartPose.offsetAndRotation(0.0F, -1.0F, 1.0F, 0.3927F, 0.0F, 0.0F)
);
head.addOrReplaceChild(
"left_ear",
CubeListBuilder.create().texOffs(0, 0).addBox(-2.0F, -6.5F, -0.3F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)),
PartPose.offsetAndRotation(2.0F, -3.5F, -1.0F, 0.48F, 0.0F, 0.48F)
);
head.addOrReplaceChild(
"right_ear",
CubeListBuilder.create().texOffs(22, 0).mirror().addBox(-2.0F, -6.5F, -0.3F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false),
PartPose.offsetAndRotation(-2.0F, -3.5F, -1.0F, 0.48F, 0.0F, -0.48F)
);
body.addOrReplaceChild("right_chest", CubeListBuilder.create(), PartPose.offset(-1.0F, 10.0F, 0.0F));
body.addOrReplaceChild("left_chest", CubeListBuilder.create(), PartPose.offset(-1.0F, 10.0F, 0.0F));
return LayerDefinition.create(meshdefinition, 64, 64);
}
@Override
public void setupAnim(DonkeyRenderState state) {
super.setupAnim(state);
state.xRot = -30.0F;
float headRotXRad = state.xRot * (float) (Math.PI / 180.0);
float eating = state.eatAnimation;
float standing = state.standAnimation;
float feedingAnim = state.feedingAnimation;
float baseHeadAngle = (1.0F - Math.max(standing, eating)) * ((float) (Math.PI / 6) + headRotXRad + feedingAnim * Mth.sin(state.ageInTicks) * 0.05F);
this.headParts.xRot = standing * ((float) (Math.PI / 12) + headRotXRad)
+ eating * ((float) (Math.PI / 2) + Mth.sin(state.ageInTicks) * 0.05F)
+ baseHeadAngle;
}
@Override
protected void offsetLegPositionWhenStanding(float standing) {
this.leftHindLeg.y = Mth.lerp(standing, this.leftHindLeg.y, -0.3F);
this.rightHindLeg.y = Mth.lerp(standing, this.leftHindLeg.y, -0.3F);
}
@Override
protected float getLegStandAngle() {
return (float) (Math.PI / 3);
}
@Override
protected float getLegStandingYOffset() {
return 1.0F;
}
@Override
protected float getLegStandingZOffset() {
return 0.5F;
}
@Override
protected float getLegStandingXRotOffset() {
return 0.0F;
}
@Override
protected float getTailXRotOffset() {
return (float) (-Math.PI / 4);
}
@Override
protected void animateHeadPartsPlacement(float eating, float standing) {
this.headParts.y = Mth.lerp(eating, this.headParts.y, -1.2F);
this.headParts.z = Mth.lerp(standing, this.headParts.z, -3.6F);
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset(), PartPose.offsetAndRotation()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
CubeDeformation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.lerp(), Mth.sin()
- 引用位置: