ElytraModel.java

net.minecraft.client.model.object.equipment.ElytraModel

信息

  • 全限定名:net.minecraft.client.model.object.equipment.ElytraModel
  • 类型:public class
  • 包:net.minecraft.client.model.object.equipment
  • 源码路径:src/main/java/net/minecraft/client/model/object/equipment/ElytraModel.java
  • 起始行号:L17
  • 继承:EntityModel
  • 职责:

    TODO

字段/常量

  • BABY_TRANSFORMER

    • 类型: MeshTransformer
    • 修饰符: public static final
    • 源码定位: L18
    • 说明:

      TODO

  • rightWing

    • 类型: ModelPart
    • 修饰符: private final
    • 源码定位: L19
    • 说明:

      TODO

  • leftWing

    • 类型: ModelPart
    • 修饰符: private final
    • 源码定位: L20
    • 说明:

      TODO

内部类/嵌套类型

构造器

public ElytraModel(ModelPart root) @ L22

  • 构造器名:ElytraModel
  • 源码定位:L22
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static LayerDefinition createLayer() @ L28

  • 方法名:createLayer
  • 源码定位:L28
  • 返回类型:LayerDefinition
  • 修饰符:public static

参数:

说明:

TODO

public void setupAnim(HumanoidRenderState state) @ L45

  • 方法名:setupAnim
  • 源码定位:L45
  • 返回类型:void
  • 修饰符:public

参数:

  • state: HumanoidRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ElytraModel extends EntityModel<HumanoidRenderState> {
    public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5F);
    private final ModelPart rightWing;
    private final ModelPart leftWing;
 
    public ElytraModel(ModelPart root) {
        super(root);
        this.leftWing = root.getChild("left_wing");
        this.rightWing = root.getChild("right_wing");
    }
 
    public static LayerDefinition createLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        CubeDeformation windDeformation = new CubeDeformation(1.0F);
        root.addOrReplaceChild(
            "left_wing",
            CubeListBuilder.create().texOffs(22, 0).addBox(-10.0F, 0.0F, 0.0F, 10.0F, 20.0F, 2.0F, windDeformation),
            PartPose.offsetAndRotation(5.0F, 0.0F, 0.0F, (float) (Math.PI / 12), 0.0F, (float) (-Math.PI / 12))
        );
        root.addOrReplaceChild(
            "right_wing",
            CubeListBuilder.create().texOffs(22, 0).mirror().addBox(0.0F, 0.0F, 0.0F, 10.0F, 20.0F, 2.0F, windDeformation),
            PartPose.offsetAndRotation(-5.0F, 0.0F, 0.0F, (float) (Math.PI / 12), 0.0F, (float) (Math.PI / 12))
        );
        return LayerDefinition.create(mesh, 64, 32);
    }
 
    public void setupAnim(HumanoidRenderState state) {
        super.setupAnim(state);
        this.leftWing.y = state.isCrouching ? 3.0F : 0.0F;
        this.leftWing.xRot = state.elytraRotX;
        this.leftWing.zRot = state.elytraRotZ;
        this.leftWing.yRot = state.elytraRotY;
        this.rightWing.yRot = -this.leftWing.yRot;
        this.rightWing.y = this.leftWing.y;
        this.rightWing.xRot = this.leftWing.xRot;
        this.rightWing.zRot = -this.leftWing.zRot;
    }
}

引用的其他类