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 egm) {
        super(egm);
        this.model = new EvokerFangsModel<EvokerFangs>();
    }
    
    @Override
    public void render(final EvokerFangs bek, final float float2, final float float3, final PoseStack dhl, final MultiBufferSource ebz, final int integer) {
        final float float4 = bek.getAnimationProgress(float3);
        if (float4 == 0.0f) {
            return;
        }
        float float5 = 2.0f;
        if (float4 > 0.9f) {
            float5 *= (float)((1.0 - float4) / 0.10000000149011612);
        }
        dhl.pushPose();
        dhl.mulPose(Vector3f.YP.rotationDegrees(90.0f - bek.yRot));
        dhl.scale(-float5, -float5, float5);
        final float float6 = 0.03125f;
        dhl.translate(0.0, -0.6259999871253967, 0.0);
        dhl.scale(0.5f, 0.5f, 0.5f);
        this.model.setupAnim(bek, float4, 0.0f, 0.0f, bek.yRot, bek.xRot);
        final VertexConsumer dhp11 = ebz.getBuffer(this.model.renderType(EvokerFangsRenderer.TEXTURE_LOCATION));
        this.model.renderToBuffer(dhl, dhp11, integer, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
        dhl.popPose();
        super.render(bek, float2, float3, dhl, ebz, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final EvokerFangs bek) {
        return EvokerFangsRenderer.TEXTURE_LOCATION;
    }
    
    static {
        TEXTURE_LOCATION = new ResourceLocation("textures/entity/illager/evoker_fangs.png");
    }
}
