minecraft-src/net/minecraft/client/renderer/entity/ChickenRenderer.java
2025-07-04 01:41:11 +03:00

34 lines
1.2 KiB
Java

package net.minecraft.client.renderer.entity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ChickenModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.animal.Chicken;
@Environment(EnvType.CLIENT)
public class ChickenRenderer extends MobRenderer<Chicken, ChickenModel<Chicken>> {
private static final ResourceLocation CHICKEN_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/chicken.png");
public ChickenRenderer(EntityRendererProvider.Context context) {
super(context, new ChickenModel<>(context.bakeLayer(ModelLayers.CHICKEN)), 0.3F);
}
/**
* Returns the location of an entity's texture.
*/
public ResourceLocation getTextureLocation(Chicken entity) {
return CHICKEN_LOCATION;
}
/**
* Defines what float the third param in setRotationAngles of ModelBase is
*/
protected float getBob(Chicken livingBase, float partialTicks) {
float f = Mth.lerp(partialTicks, livingBase.oFlap, livingBase.flap);
float g = Mth.lerp(partialTicks, livingBase.oFlapSpeed, livingBase.flapSpeed);
return (Mth.sin(f) + 1.0F) * g;
}
}