GhastModel.java
net.minecraft.client.model.monster.ghast.GhastModel
信息
- 全限定名:net.minecraft.client.model.monster.ghast.GhastModel
- 类型:public class
- 包:net.minecraft.client.model.monster.ghast
- 源码路径:src/main/java/net/minecraft/client/model/monster/ghast/GhastModel.java
- 起始行号:L20
- 继承:EntityModel
- 职责:
TODO
字段/常量
tentacles- 类型:
ModelPart[] - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public GhastModel(ModelPart root) @ L23
- 构造器名:GhastModel
- 源码定位:L23
- 修饰符:public
参数:
- root: ModelPart
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static LayerDefinition createBodyLayer() @ L31
- 方法名:createBodyLayer
- 源码定位:L31
- 返回类型:LayerDefinition
- 修饰符:public static
参数:
- 无
说明:
TODO
public void setupAnim(GhastRenderState state) @ L51
- 方法名:setupAnim
- 源码定位:L51
- 返回类型:void
- 修饰符:public
参数:
- state: GhastRenderState
说明:
TODO
public static void animateTentacles(EntityRenderState state, ModelPart[] tentacles) @ L56
- 方法名:animateTentacles
- 源码定位:L56
- 返回类型:void
- 修饰符:public static
参数:
- state: EntityRenderState
- tentacles: ModelPart[]
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class GhastModel extends EntityModel<GhastRenderState> {
private final ModelPart[] tentacles = new ModelPart[9];
public GhastModel(ModelPart root) {
super(root);
for (int i = 0; i < this.tentacles.length; i++) {
this.tentacles[i] = root.getChild(PartNames.tentacle(i));
}
}
public static LayerDefinition createBodyLayer() {
MeshDefinition mesh = new MeshDefinition();
PartDefinition root = mesh.getRoot();
root.addOrReplaceChild(
"body", CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -8.0F, -8.0F, 16.0F, 16.0F, 16.0F), PartPose.offset(0.0F, 17.6F, 0.0F)
);
RandomSource random = RandomSource.createThreadLocalInstance(1660L);
for (int i = 0; i < 9; i++) {
float xo = ((i % 3 - i / 3 % 2 * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F;
float yo = (i / 3 / 2.0F * 2.0F - 1.0F) * 5.0F;
int len = random.nextInt(7) + 8;
root.addOrReplaceChild(
PartNames.tentacle(i), CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, 0.0F, -1.0F, 2.0F, len, 2.0F), PartPose.offset(xo, 24.6F, yo)
);
}
return LayerDefinition.create(mesh, 64, 32).apply(MeshTransformer.scaling(4.5F));
}
public void setupAnim(GhastRenderState state) {
super.setupAnim(state);
animateTentacles(state, this.tentacles);
}
public static void animateTentacles(EntityRenderState state, ModelPart[] tentacles) {
for (int i = 0; i < tentacles.length; i++) {
tentacles[i].xRot = 0.2F * Mth.sin(state.ageInTicks * 0.3F + i) + 0.4F;
}
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartNames.tentacle()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
PartPose.offset()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CubeListBuilder.create()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
LayerDefinition.create()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MeshDefinition()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
MeshTransformer.scaling()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.sin()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
RandomSource.createThreadLocalInstance()
- 引用位置: