WitherBossRenderer.java

net.minecraft.client.renderer.entity.WitherBossRenderer

信息

  • 全限定名:net.minecraft.client.renderer.entity.WitherBossRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer.entity
  • 源码路径:src/main/java/net/minecraft/client/renderer/entity/WitherBossRenderer.java
  • 起始行号:L16
  • 继承:MobRenderer<WitherBoss,WitherRenderState,WitherBossModel>
  • 职责:

    TODO

字段/常量

  • WITHER_INVULNERABLE_LOCATION

    • 类型: Identifier
    • 修饰符: private static final
    • 源码定位: L17
    • 说明:

      TODO

  • WITHER_LOCATION

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

      TODO

内部类/嵌套类型

构造器

public WitherBossRenderer(EntityRendererProvider.Context context) @ L20

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

参数:

  • context: EntityRendererProvider.Context

说明:

TODO

方法

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

protected int getBlockLightLevel(WitherBoss entity, BlockPos blockPos) @ L25

  • 方法名:getBlockLightLevel
  • 源码定位:L25
  • 返回类型:int
  • 修饰符:protected

参数:

  • entity: WitherBoss
  • blockPos: BlockPos

说明:

TODO

public Identifier getTextureLocation(WitherRenderState state) @ L29

  • 方法名:getTextureLocation
  • 源码定位:L29
  • 返回类型:Identifier
  • 修饰符:public

参数:

  • state: WitherRenderState

说明:

TODO

public WitherRenderState createRenderState() @ L34

  • 方法名:createRenderState
  • 源码定位:L34
  • 返回类型:WitherRenderState
  • 修饰符:public

参数:

说明:

TODO

protected void scale(WitherRenderState state, PoseStack poseStack) @ L38

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

参数:

  • state: WitherRenderState
  • poseStack: PoseStack

说明:

TODO

public void extractRenderState(WitherBoss entity, WitherRenderState state, float partialTicks) @ L47

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

参数:

  • entity: WitherBoss
  • state: WitherRenderState
  • partialTicks: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class WitherBossRenderer extends MobRenderer<WitherBoss, WitherRenderState, WitherBossModel> {
    private static final Identifier WITHER_INVULNERABLE_LOCATION = Identifier.withDefaultNamespace("textures/entity/wither/wither_invulnerable.png");
    private static final Identifier WITHER_LOCATION = Identifier.withDefaultNamespace("textures/entity/wither/wither.png");
 
    public WitherBossRenderer(EntityRendererProvider.Context context) {
        super(context, new WitherBossModel(context.bakeLayer(ModelLayers.WITHER)), 1.0F);
        this.addLayer(new WitherArmorLayer(this, context.getModelSet()));
    }
 
    protected int getBlockLightLevel(WitherBoss entity, BlockPos blockPos) {
        return 15;
    }
 
    public Identifier getTextureLocation(WitherRenderState state) {
        int invulnerableTicks = Mth.floor(state.invulnerableTicks);
        return invulnerableTicks > 0 && (invulnerableTicks > 80 || invulnerableTicks / 5 % 2 != 1) ? WITHER_INVULNERABLE_LOCATION : WITHER_LOCATION;
    }
 
    public WitherRenderState createRenderState() {
        return new WitherRenderState();
    }
 
    protected void scale(WitherRenderState state, PoseStack poseStack) {
        float scale = 2.0F;
        if (state.invulnerableTicks > 0.0F) {
            scale -= state.invulnerableTicks / 220.0F * 0.5F;
        }
 
        poseStack.scale(scale, scale, scale);
    }
 
    public void extractRenderState(WitherBoss entity, WitherRenderState state, float partialTicks) {
        super.extractRenderState(entity, state, partialTicks);
        int invulnerableTicks = entity.getInvulnerableTicks();
        state.invulnerableTicks = invulnerableTicks > 0 ? invulnerableTicks - partialTicks : 0.0F;
        System.arraycopy(entity.getHeadXRots(), 0, state.xHeadRots, 0, state.xHeadRots.length);
        System.arraycopy(entity.getHeadYRots(), 0, state.yHeadRots, 0, state.yHeadRots.length);
        state.isPowered = entity.isPowered();
    }
}

引用的其他类