2025-11-24 22:52:51 +03:00

53 lines
2.3 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.renderer.entity;
import net.minecraft.client.model.LlamaModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.renderer.entity.AgeableMobRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.layers.LlamaDecorLayer;
import net.minecraft.client.renderer.entity.state.LlamaRenderState;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.animal.horse.Llama;
public class LlamaRenderer
extends AgeableMobRenderer<Llama, LlamaRenderState, LlamaModel> {
private static final Identifier CREAMY = Identifier.withDefaultNamespace("textures/entity/llama/creamy.png");
private static final Identifier WHITE = Identifier.withDefaultNamespace("textures/entity/llama/white.png");
private static final Identifier BROWN = Identifier.withDefaultNamespace("textures/entity/llama/brown.png");
private static final Identifier GRAY = Identifier.withDefaultNamespace("textures/entity/llama/gray.png");
public LlamaRenderer(EntityRendererProvider.Context context, ModelLayerLocation model, ModelLayerLocation babyModel) {
super(context, new LlamaModel(context.bakeLayer(model)), new LlamaModel(context.bakeLayer(babyModel)), 0.7f);
this.addLayer(new LlamaDecorLayer(this, context.getModelSet(), context.getEquipmentRenderer()));
}
@Override
public Identifier getTextureLocation(LlamaRenderState state) {
return switch (state.variant) {
default -> throw new MatchException(null, null);
case Llama.Variant.CREAMY -> CREAMY;
case Llama.Variant.WHITE -> WHITE;
case Llama.Variant.BROWN -> BROWN;
case Llama.Variant.GRAY -> GRAY;
};
}
@Override
public LlamaRenderState createRenderState() {
return new LlamaRenderState();
}
@Override
public void extractRenderState(Llama entity, LlamaRenderState state, float partialTicks) {
super.extractRenderState(entity, state, partialTicks);
state.variant = entity.getVariant();
state.hasChest = !entity.isBaby() && entity.hasChest();
state.bodyItem = entity.getBodyArmorItem();
state.isTraderLlama = entity.isTraderLlama();
}
}