66 lines
3.1 KiB
Java
66 lines
3.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.renderer.entity;
|
|
|
|
import net.minecraft.client.model.DonkeyModel;
|
|
import net.minecraft.client.model.EquineSaddleModel;
|
|
import net.minecraft.client.model.geom.ModelLayerLocation;
|
|
import net.minecraft.client.model.geom.ModelLayers;
|
|
import net.minecraft.client.renderer.entity.AbstractHorseRenderer;
|
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
|
import net.minecraft.client.renderer.entity.layers.SimpleEquipmentLayer;
|
|
import net.minecraft.client.renderer.entity.state.DonkeyRenderState;
|
|
import net.minecraft.client.resources.model.EquipmentClientInfo;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
|
|
|
|
public class DonkeyRenderer<T extends AbstractChestedHorse>
|
|
extends AbstractHorseRenderer<T, DonkeyRenderState, DonkeyModel> {
|
|
private final Identifier texture;
|
|
|
|
public DonkeyRenderer(EntityRendererProvider.Context context, Type type) {
|
|
super(context, new DonkeyModel(context.bakeLayer(type.model)), new DonkeyModel(context.bakeLayer(type.babyModel)));
|
|
this.texture = type.texture;
|
|
this.addLayer(new SimpleEquipmentLayer<DonkeyRenderState, DonkeyModel, EquineSaddleModel>(this, context.getEquipmentRenderer(), type.saddleLayer, state -> state.saddle, new EquineSaddleModel(context.bakeLayer(type.saddleModel)), new EquineSaddleModel(context.bakeLayer(type.babySaddleModel))));
|
|
}
|
|
|
|
@Override
|
|
public Identifier getTextureLocation(DonkeyRenderState state) {
|
|
return this.texture;
|
|
}
|
|
|
|
@Override
|
|
public DonkeyRenderState createRenderState() {
|
|
return new DonkeyRenderState();
|
|
}
|
|
|
|
@Override
|
|
public void extractRenderState(T entity, DonkeyRenderState state, float partialTicks) {
|
|
super.extractRenderState(entity, state, partialTicks);
|
|
state.hasChest = ((AbstractChestedHorse)entity).hasChest();
|
|
}
|
|
|
|
public static enum Type {
|
|
DONKEY(Identifier.withDefaultNamespace("textures/entity/horse/donkey.png"), ModelLayers.DONKEY, ModelLayers.DONKEY_BABY, EquipmentClientInfo.LayerType.DONKEY_SADDLE, ModelLayers.DONKEY_SADDLE, ModelLayers.DONKEY_BABY_SADDLE),
|
|
MULE(Identifier.withDefaultNamespace("textures/entity/horse/mule.png"), ModelLayers.MULE, ModelLayers.MULE_BABY, EquipmentClientInfo.LayerType.MULE_SADDLE, ModelLayers.MULE_SADDLE, ModelLayers.MULE_BABY_SADDLE);
|
|
|
|
private final Identifier texture;
|
|
private final ModelLayerLocation model;
|
|
private final ModelLayerLocation babyModel;
|
|
private final EquipmentClientInfo.LayerType saddleLayer;
|
|
private final ModelLayerLocation saddleModel;
|
|
private final ModelLayerLocation babySaddleModel;
|
|
|
|
private Type(Identifier texture, ModelLayerLocation model, ModelLayerLocation babyModel, EquipmentClientInfo.LayerType saddleLayer, ModelLayerLocation saddleModel, ModelLayerLocation babySaddleModel) {
|
|
this.texture = texture;
|
|
this.model = model;
|
|
this.babyModel = babyModel;
|
|
this.saddleLayer = saddleLayer;
|
|
this.saddleModel = saddleModel;
|
|
this.babySaddleModel = babySaddleModel;
|
|
}
|
|
}
|
|
}
|
|
|