TadpoleModel.java

net.minecraft.client.model.animal.frog.TadpoleModel

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

构造器

public TadpoleModel(ModelPart root) @ L20

  • 构造器名:TadpoleModel
  • 源码定位:L20
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public static LayerDefinition createBodyLayer() @ L25

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

参数:

说明:

TODO

public void setupAnim(LivingEntityRenderState state) @ L36

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

参数:

  • state: LivingEntityRenderState

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class TadpoleModel extends EntityModel<LivingEntityRenderState> {
    private final ModelPart tail;
 
    public TadpoleModel(ModelPart root) {
        super(root, RenderTypes::entityCutout);
        this.tail = root.getChild("tail");
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = new MeshDefinition();
        PartDefinition root = mesh.getRoot();
        float xo = 0.0F;
        float yo = 22.0F;
        float zo = -3.0F;
        root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-1.5F, -1.0F, 0.0F, 3.0F, 2.0F, 3.0F), PartPose.offset(0.0F, 22.0F, -3.0F));
        root.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -1.0F, 0.0F, 0.0F, 2.0F, 7.0F), PartPose.offset(0.0F, 22.0F, 0.0F));
        return LayerDefinition.create(mesh, 16, 16);
    }
 
    public void setupAnim(LivingEntityRenderState state) {
        super.setupAnim(state);
        float amplitudeMultiplier = state.isInWater ? 1.0F : 1.5F;
        this.tail.yRot = -amplitudeMultiplier * 0.25F * Mth.sin(0.3F * state.ageInTicks);
    }
}

引用的其他类