minecraft-src/net/minecraft/client/renderer/entity/DonkeyRenderer.java
2025-07-04 02:49:36 +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, float scale, ModelLayerLocation adultModelLayer, ModelLayerLocation babyModelLayer, boolean mule) {
super(context, new DonkeyModel(context.bakeLayer(adultModelLayer)), new DonkeyModel(context.bakeLayer(babyModelLayer)), scale);
this.texture = mule ? MULE_TEXTURE : DONKEY_TEXTURE;
}
public ResourceLocation getTextureLocation(DonkeyRenderState renderState) {
return this.texture;
}
public DonkeyRenderState createRenderState() {
return new DonkeyRenderState();
}
public void extractRenderState(T entity, DonkeyRenderState reusedState, float partialTick) {
super.extractRenderState(entity, reusedState, partialTick);
reusedState.hasChest = entity.hasChest();
}
}