UndeadHorseRenderer.java

net.minecraft.client.renderer.entity.UndeadHorseRenderer

信息

  • 全限定名:net.minecraft.client.renderer.entity.UndeadHorseRenderer
  • 类型:public class
  • 包:net.minecraft.client.renderer.entity
  • 源码路径:src/main/java/net/minecraft/client/renderer/entity/UndeadHorseRenderer.java
  • 起始行号:L18
  • 继承:AbstractHorseRenderer<AbstractHorse,EquineRenderState,AbstractEquineModel>
  • 职责:

    TODO

字段/常量

  • adultTexture

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

      TODO

  • babyTexture

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

      TODO

内部类/嵌套类型

  • net.minecraft.client.renderer.entity.UndeadHorseRenderer.Type
    • 类型: enum
    • 修饰符: public static
    • 源码定位: L58
    • 说明:

      TODO

构造器

public UndeadHorseRenderer(EntityRendererProvider.Context context, EquipmentClientInfo.LayerType saddleLayer, ModelLayerLocation saddleModel, UndeadHorseRenderer.Type adult, UndeadHorseRenderer.Type baby) @ L22

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

参数:

  • context: EntityRendererProvider.Context
  • saddleLayer: EquipmentClientInfo.LayerType
  • saddleModel: ModelLayerLocation
  • adult: UndeadHorseRenderer.Type
  • baby: UndeadHorseRenderer.Type

说明:

TODO

方法

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

public Identifier getTextureLocation(EquineRenderState state) @ L49

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

参数:

  • state: EquineRenderState

说明:

TODO

public EquineRenderState createRenderState() @ L53

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class UndeadHorseRenderer extends AbstractHorseRenderer<AbstractHorse, EquineRenderState, AbstractEquineModel<EquineRenderState>> {
    private final Identifier adultTexture;
    private final Identifier babyTexture;
 
    public UndeadHorseRenderer(
        EntityRendererProvider.Context context,
        EquipmentClientInfo.LayerType saddleLayer,
        ModelLayerLocation saddleModel,
        UndeadHorseRenderer.Type adult,
        UndeadHorseRenderer.Type baby
    ) {
        super(context, new HorseModel(context.bakeLayer(adult.model)), new BabyHorseModel(context.bakeLayer(baby.model)));
        this.adultTexture = adult.texture;
        this.babyTexture = baby.texture;
        this.addLayer(
            new SimpleEquipmentLayer<>(
                this,
                context.getEquipmentRenderer(),
                EquipmentClientInfo.LayerType.HORSE_BODY,
                state -> state.bodyArmorItem,
                new HorseModel(context.bakeLayer(ModelLayers.UNDEAD_HORSE_ARMOR)),
                null
            )
        );
        this.addLayer(
            new SimpleEquipmentLayer<>(
                this, context.getEquipmentRenderer(), saddleLayer, state -> state.saddle, new EquineSaddleModel(context.bakeLayer(saddleModel)), null
            )
        );
    }
 
    public Identifier getTextureLocation(EquineRenderState state) {
        return state.isBaby ? this.babyTexture : this.adultTexture;
    }
 
    public EquineRenderState createRenderState() {
        return new EquineRenderState();
    }
 
    @OnlyIn(Dist.CLIENT)
    public static enum Type {
        SKELETON(Identifier.withDefaultNamespace("textures/entity/horse/horse_skeleton.png"), ModelLayers.SKELETON_HORSE),
        SKELETON_BABY(Identifier.withDefaultNamespace("textures/entity/horse/horse_skeleton_baby.png"), ModelLayers.SKELETON_HORSE_BABY),
        ZOMBIE(Identifier.withDefaultNamespace("textures/entity/horse/horse_zombie.png"), ModelLayers.ZOMBIE_HORSE),
        ZOMBIE_BABY(Identifier.withDefaultNamespace("textures/entity/horse/horse_zombie_baby.png"), ModelLayers.ZOMBIE_HORSE_BABY);
 
        private final Identifier texture;
        private final ModelLayerLocation model;
 
        private Type(Identifier texture, ModelLayerLocation model) {
            this.texture = texture;
            this.model = model;
        }
    }
}

引用的其他类