package net.minecraft.client.renderer.entity;

import net.minecraft.world.entity.Entity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.util.Mth;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.model.LlamaSpitModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.LlamaSpit;

public class LlamaSpitRenderer extends EntityRenderer<LlamaSpit> {
    private static final ResourceLocation LLAMA_SPIT_LOCATION;
    private final LlamaSpitModel<LlamaSpit> model;
    
    public LlamaSpitRenderer(final EntityRenderDispatcher dvf) {
        super(dvf);
        this.model = new LlamaSpitModel<LlamaSpit>();
    }
    
    @Override
    public void render(final LlamaSpit ayx, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        cyl.pushPose();
        cyl.translate(0.0, 0.15000000596046448, 0.0);
        cyl.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(float3, ayx.yRotO, ayx.yRot) - 90.0f));
        cyl.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(float3, ayx.xRotO, ayx.xRot)));
        this.model.setupAnim(ayx, float3, 0.0f, -0.1f, 0.0f, 0.0f);
        final VertexConsumer cyo8 = dqt.getBuffer(this.model.renderType(LlamaSpitRenderer.LLAMA_SPIT_LOCATION));
        this.model.renderToBuffer(cyl, cyo8, integer, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
        cyl.popPose();
        super.render(ayx, float2, float3, cyl, dqt, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final LlamaSpit ayx) {
        return LlamaSpitRenderer.LLAMA_SPIT_LOCATION;
    }
    
    static {
        LLAMA_SPIT_LOCATION = new ResourceLocation("textures/entity/llama/spit.png");
    }
}
