IronGolemModel.java
net.minecraft.client.model.animal.golem.IronGolemModel
信息
- 全限定名:net.minecraft.client.model.animal.golem.IronGolemModel
- 类型:public class
- 包:net.minecraft.client.model.animal.golem
- 源码路径:src/main/java/net/minecraft/client/model/animal/golem/IronGolemModel.java
- 起始行号:L17
- 继承:EntityModel
- 职责:
TODO
字段/常量
-
head- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
rightArm- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
leftArm- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
rightLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
leftLeg- 类型:
ModelPart - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public IronGolemModel(ModelPart root) @ L24
- 构造器名:IronGolemModel
- 源码定位:L24
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L33
- 方法名:createBodyLayer
- 源码定位:L33
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(IronGolemRenderState state) @ L65
- 方法名:setupAnim
- 源码定位:L65
- 返回类型:void
- 修饰符:public
参数:
- state: IronGolemRenderState
说明:
TODO
public ModelPart getFlowerHoldingArm() @ L92
- 方法名:getFlowerHoldingArm
- 源码定位:L92
- 返回类型:ModelPart
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class IronGolemModel extends EntityModel<IronGolemRenderState> {
private final ModelPart head;
private final ModelPart rightArm;
private final ModelPart leftArm;
private final ModelPart rightLeg;
private final ModelPart leftLeg;
public IronGolemModel(ModelPart root) {
super(root);
this.head = root.getChild("head");
this.rightArm = root.getChild("right_arm");
this.leftArm = root.getChild("left_arm");
this.rightLeg = root.getChild("right_leg");
this.leftLeg = root.getChild("left_leg");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition mesh = new MeshDefinition();
PartDefinition root = mesh.getRoot();
root.addOrReplaceChild(
"head",
CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8.0F, 10.0F, 8.0F).texOffs(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2.0F, 4.0F, 2.0F),
PartPose.offset(0.0F, -7.0F, -2.0F)
);
root.addOrReplaceChild(
"body",
CubeListBuilder.create()
.texOffs(0, 40)
.addBox(-9.0F, -2.0F, -6.0F, 18.0F, 12.0F, 11.0F)
.texOffs(0, 70)
.addBox(-4.5F, 10.0F, -3.0F, 9.0F, 5.0F, 6.0F, new CubeDeformation(0.5F)),
PartPose.offset(0.0F, -7.0F, 0.0F)
);
root.addOrReplaceChild(
"right_arm", CubeListBuilder.create().texOffs(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4.0F, 30.0F, 6.0F), PartPose.offset(0.0F, -7.0F, 0.0F)
);
root.addOrReplaceChild(
"left_arm", CubeListBuilder.create().texOffs(60, 58).addBox(9.0F, -2.5F, -3.0F, 4.0F, 30.0F, 6.0F), PartPose.offset(0.0F, -7.0F, 0.0F)
);
root.addOrReplaceChild(
"right_leg", CubeListBuilder.create().texOffs(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6.0F, 16.0F, 5.0F), PartPose.offset(-4.0F, 11.0F, 0.0F)
);
root.addOrReplaceChild(
"left_leg", CubeListBuilder.create().texOffs(60, 0).mirror().addBox(-3.5F, -3.0F, -3.0F, 6.0F, 16.0F, 5.0F), PartPose.offset(5.0F, 11.0F, 0.0F)
);
return LayerDefinition.create(mesh, 128, 128);
}
public void setupAnim(IronGolemRenderState state) {
super.setupAnim(state);
float attackTick = state.attackTicksRemaining;
float animationSpeed = state.walkAnimationSpeed;
float animationPos = state.walkAnimationPos;
if (attackTick > 0.0F) {
this.rightArm.xRot = -2.0F + 1.5F * Mth.triangleWave(attackTick, 10.0F);
this.leftArm.xRot = -2.0F + 1.5F * Mth.triangleWave(attackTick, 10.0F);
} else {
int offerFlowerTick = state.offerFlowerTick;
if (offerFlowerTick > 0) {
this.rightArm.xRot = -0.8F + 0.025F * Mth.triangleWave(offerFlowerTick, 70.0F);
this.leftArm.xRot = 0.0F;
} else {
this.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(animationPos, 13.0F)) * animationSpeed;
this.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(animationPos, 13.0F)) * animationSpeed;
}
}
this.head.yRot = state.yRot * (float) (Math.PI / 180.0);
this.head.xRot = state.xRot * (float) (Math.PI / 180.0);
this.rightLeg.xRot = -1.5F * Mth.triangleWave(animationPos, 13.0F) * animationSpeed;
this.leftLeg.xRot = 1.5F * Mth.triangleWave(animationPos, 13.0F) * animationSpeed;
this.rightLeg.yRot = 0.0F;
this.leftLeg.yRot = 0.0F;
}
public ModelPart getFlowerHoldingArm() {
return this.rightArm;
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
CubeDeformation()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.triangleWave()
- 引用位置: