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 com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.model.EvokerFangsModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.EvokerFangs;

public class EvokerFangsRenderer extends EntityRenderer<EvokerFangs> {
    private static final ResourceLocation TEXTURE_LOCATION;
    private final EvokerFangsModel<EvokerFangs> model;
    
    public EvokerFangsRenderer(final EntityRenderDispatcher dvf) {
        super(dvf);
        this.model = new EvokerFangsModel<EvokerFangs>();
    }
    
    @Override
    public void render(final EvokerFangs ayr, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        final float float4 = ayr.getAnimationProgress(float3);
        if (float4 == 0.0f) {
            return;
        }
        float float5 = 2.0f;
        if (float4 > 0.9f) {
            float5 *= (float)((1.0 - float4) / 0.10000000149011612);
        }
        cyl.pushPose();
        cyl.mulPose(Vector3f.YP.rotationDegrees(90.0f - ayr.yRot));
        cyl.scale(-float5, -float5, float5);
        final float float6 = 0.03125f;
        cyl.translate(0.0, -0.6259999871253967, 0.0);
        cyl.scale(0.5f, 0.5f, 0.5f);
        this.model.setupAnim(ayr, float4, 0.0f, 0.0f, ayr.yRot, ayr.xRot);
        final VertexConsumer cyo11 = dqt.getBuffer(this.model.renderType(EvokerFangsRenderer.TEXTURE_LOCATION));
        this.model.renderToBuffer(cyl, cyo11, integer, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
        cyl.popPose();
        super.render(ayr, float2, float3, cyl, dqt, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final EvokerFangs ayr) {
        return EvokerFangsRenderer.TEXTURE_LOCATION;
    }
    
    static {
        TEXTURE_LOCATION = new ResourceLocation("textures/entity/illager/evoker_fangs.png");
    }
}
