BeeModel.java

net.minecraft.client.model.animal.bee.BeeModel

信息

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

    TODO

字段/常量

  • BONE

    • 类型: String
    • 修饰符: protected static final
    • 源码定位: L12
    • 说明:

      TODO

  • STINGER

    • 类型: String
    • 修饰符: protected static final
    • 源码定位: L13
    • 说明:

      TODO

  • FRONT_LEGS

    • 类型: String
    • 修饰符: protected static final
    • 源码定位: L14
    • 说明:

      TODO

  • MIDDLE_LEGS

    • 类型: String
    • 修饰符: protected static final
    • 源码定位: L15
    • 说明:

      TODO

  • BACK_LEGS

    • 类型: String
    • 修饰符: protected static final
    • 源码定位: L16
    • 说明:

      TODO

  • bone

    • 类型: ModelPart
    • 修饰符: protected final
    • 源码定位: L17
    • 说明:

      TODO

  • rightWing

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

      TODO

  • leftWing

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

      TODO

  • frontLeg

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

      TODO

  • midLeg

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

      TODO

  • backLeg

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

      TODO

  • stinger

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

      TODO

内部类/嵌套类型

构造器

public BeeModel(ModelPart root) @ L25

  • 构造器名:BeeModel
  • 源码定位:L25
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

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

public void setupAnim(BeeRenderState state) @ L37

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

参数:

  • state: BeeRenderState

说明:

TODO

protected void bobUpAndDown(float speed, float ageInTicks) @ L63

  • 方法名:bobUpAndDown
  • 源码定位:L63
  • 返回类型:void
  • 修饰符:protected

参数:

  • speed: float
  • ageInTicks: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class BeeModel extends EntityModel<BeeRenderState> {
    protected static final String BONE = "bone";
    protected static final String STINGER = "stinger";
    protected static final String FRONT_LEGS = "front_legs";
    protected static final String MIDDLE_LEGS = "middle_legs";
    protected static final String BACK_LEGS = "back_legs";
    protected final ModelPart bone;
    private final ModelPart rightWing;
    private final ModelPart leftWing;
    private final ModelPart frontLeg;
    private final ModelPart midLeg;
    private final ModelPart backLeg;
    private final ModelPart stinger;
 
    public BeeModel(ModelPart root) {
        super(root);
        this.bone = root.getChild("bone");
        ModelPart body = this.bone.getChild("body");
        this.stinger = body.getChild("stinger");
        this.rightWing = this.bone.getChild("right_wing");
        this.leftWing = this.bone.getChild("left_wing");
        this.frontLeg = this.bone.getChild("front_legs");
        this.midLeg = this.bone.getChild("middle_legs");
        this.backLeg = this.bone.getChild("back_legs");
    }
 
    public void setupAnim(BeeRenderState state) {
        super.setupAnim(state);
        this.stinger.visible = state.hasStinger;
        if (!state.isOnGround) {
            float speed = state.ageInTicks * 120.32113F * (float) (Math.PI / 180.0);
            this.rightWing.yRot = 0.0F;
            this.rightWing.zRot = Mth.cos(speed) * (float) Math.PI * 0.15F;
            this.leftWing.xRot = this.rightWing.xRot;
            this.leftWing.yRot = this.rightWing.yRot;
            this.leftWing.zRot = -this.rightWing.zRot;
            this.frontLeg.xRot = (float) (Math.PI / 4);
            this.midLeg.xRot = (float) (Math.PI / 4);
            this.backLeg.xRot = (float) (Math.PI / 4);
        }
 
        if (!state.isAngry && !state.isOnGround) {
            float speed = Mth.cos(state.ageInTicks * 0.18F);
            this.bobUpAndDown(speed, state.ageInTicks);
        }
 
        float rollAmount = state.rollAmount;
        if (rollAmount > 0.0F) {
            this.bone.xRot = Mth.rotLerpRad(rollAmount, this.bone.xRot, 3.0915928F);
        }
    }
 
    protected void bobUpAndDown(float speed, float ageInTicks) {
        this.bone.xRot = 0.1F + speed * (float) Math.PI * 0.025F;
        this.bone.y = this.bone.y - Mth.cos(ageInTicks * 0.18F) * 0.9F;
        this.frontLeg.xRot = -speed * (float) Math.PI * 0.1F + (float) (Math.PI / 8);
        this.backLeg.xRot = -speed * (float) Math.PI * 0.05F + (float) (Math.PI / 4);
    }
}

引用的其他类