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

37 lines
1.3 KiB
Java

package net.minecraft.client.renderer.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.CodModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.animal.Cod;
@Environment(EnvType.CLIENT)
public class CodRenderer extends MobRenderer<Cod, CodModel<Cod>> {
private static final ResourceLocation COD_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/fish/cod.png");
public CodRenderer(EntityRendererProvider.Context context) {
super(context, new CodModel<>(context.bakeLayer(ModelLayers.COD)), 0.3F);
}
/**
* Returns the location of an entity's texture.
*/
public ResourceLocation getTextureLocation(Cod entity) {
return COD_LOCATION;
}
protected void setupRotations(Cod entity, PoseStack poseStack, float bob, float yBodyRot, float partialTick, float scale) {
super.setupRotations(entity, poseStack, bob, yBodyRot, partialTick, scale);
float f = 4.3F * Mth.sin(0.6F * bob);
poseStack.mulPose(Axis.YP.rotationDegrees(f));
if (!entity.isInWater()) {
poseStack.translate(0.1F, 0.1F, -0.1F);
poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F));
}
}
}