HappyGhastRenderer.java

net.minecraft.client.renderer.entity.HappyGhastRenderer

信息

  • 全限定名:net.minecraft.client.renderer.entity.HappyGhastRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer.entity
  • 源码路径:src/main/java/net/minecraft/client/renderer/entity/HappyGhastRenderer.java
  • 起始行号:L18
  • 继承:AgeableMobRenderer<HappyGhast,HappyGhastRenderState,HappyGhastModel>
  • 职责:

    TODO

字段/常量

  • GHAST_LOCATION

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

      TODO

  • GHAST_BABY_LOCATION

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

      TODO

  • GHAST_ROPES

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

      TODO

内部类/嵌套类型

构造器

public HappyGhastRenderer(EntityRendererProvider.Context context) @ L23

  • 构造器名:HappyGhastRenderer
  • 源码定位:L23
  • 修饰符:public

参数:

  • context: EntityRendererProvider.Context

说明:

TODO

方法

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

public Identifier getTextureLocation(HappyGhastRenderState state) @ L43

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

参数:

  • state: HappyGhastRenderState

说明:

TODO

public HappyGhastRenderState createRenderState() @ L47

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

参数:

说明:

TODO

protected AABB getBoundingBoxForCulling(HappyGhast entity) @ L51

  • 方法名:getBoundingBoxForCulling
  • 源码定位:L51
  • 返回类型:AABB
  • 修饰符:protected

参数:

  • entity: HappyGhast

说明:

TODO

public void extractRenderState(HappyGhast entity, HappyGhastRenderState state, float partialTicks) @ L57

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

参数:

  • entity: HappyGhast
  • state: HappyGhastRenderState
  • partialTicks: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class HappyGhastRenderer extends AgeableMobRenderer<HappyGhast, HappyGhastRenderState, HappyGhastModel> {
    private static final Identifier GHAST_LOCATION = Identifier.withDefaultNamespace("textures/entity/ghast/happy_ghast.png");
    private static final Identifier GHAST_BABY_LOCATION = Identifier.withDefaultNamespace("textures/entity/ghast/happy_ghast_baby.png");
    private static final Identifier GHAST_ROPES = Identifier.withDefaultNamespace("textures/entity/ghast/happy_ghast_ropes.png");
 
    public HappyGhastRenderer(EntityRendererProvider.Context context) {
        super(
            context,
            new HappyGhastModel(context.bakeLayer(ModelLayers.HAPPY_GHAST)),
            new HappyGhastModel(context.bakeLayer(ModelLayers.HAPPY_GHAST_BABY)),
            2.0F
        );
        this.addLayer(
            new SimpleEquipmentLayer<>(
                this,
                context.getEquipmentRenderer(),
                EquipmentClientInfo.LayerType.HAPPY_GHAST_BODY,
                state -> state.bodyItem,
                new HappyGhastHarnessModel(context.bakeLayer(ModelLayers.HAPPY_GHAST_HARNESS)),
                new HappyGhastHarnessModel(context.bakeLayer(ModelLayers.HAPPY_GHAST_BABY_HARNESS))
            )
        );
        this.addLayer(new RopesLayer<>(this, context.getModelSet(), GHAST_ROPES));
    }
 
    public Identifier getTextureLocation(HappyGhastRenderState state) {
        return state.isBaby ? GHAST_BABY_LOCATION : GHAST_LOCATION;
    }
 
    public HappyGhastRenderState createRenderState() {
        return new HappyGhastRenderState();
    }
 
    protected AABB getBoundingBoxForCulling(HappyGhast entity) {
        AABB aabb = super.getBoundingBoxForCulling(entity);
        float height = entity.getBbHeight();
        return aabb.setMinY(aabb.minY - height / 2.0F);
    }
 
    public void extractRenderState(HappyGhast entity, HappyGhastRenderState state, float partialTicks) {
        super.extractRenderState(entity, state, partialTicks);
        state.bodyItem = entity.getItemBySlot(EquipmentSlot.BODY).copy();
        state.isRidden = entity.isVehicle();
        state.isLeashHolder = entity.isLeashHolder();
    }
}

引用的其他类