minecraft-src/net/minecraft/client/renderer/entity/DonkeyRenderer.java
2025-07-04 03:15:13 +03:00

34 lines
1.6 KiB
Java

package net.minecraft.client.renderer.entity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.DonkeyModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.renderer.entity.state.DonkeyRenderState;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
@Environment(EnvType.CLIENT)
public class DonkeyRenderer<T extends AbstractChestedHorse> extends AbstractHorseRenderer<T, DonkeyRenderState, DonkeyModel> {
public static final ResourceLocation DONKEY_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/horse/donkey.png");
public static final ResourceLocation MULE_TEXTURE = ResourceLocation.withDefaultNamespace("textures/entity/horse/mule.png");
private final ResourceLocation texture;
public DonkeyRenderer(EntityRendererProvider.Context context, ModelLayerLocation adultModel, ModelLayerLocation babyModel, boolean isMule) {
super(context, new DonkeyModel(context.bakeLayer(adultModel)), new DonkeyModel(context.bakeLayer(babyModel)));
this.texture = isMule ? MULE_TEXTURE : DONKEY_TEXTURE;
}
public ResourceLocation getTextureLocation(DonkeyRenderState donkeyRenderState) {
return this.texture;
}
public DonkeyRenderState createRenderState() {
return new DonkeyRenderState();
}
public void extractRenderState(T abstractChestedHorse, DonkeyRenderState donkeyRenderState, float f) {
super.extractRenderState(abstractChestedHorse, donkeyRenderState, f);
donkeyRenderState.hasChest = abstractChestedHorse.hasChest();
}
}