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.TridentModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.ThrownTrident;

public class ThrownTridentRenderer extends EntityRenderer<ThrownTrident> {
    public static final ResourceLocation TRIDENT_LOCATION;
    private final TridentModel model;
    
    public ThrownTridentRenderer(final EntityRenderDispatcher dvf) {
        super(dvf);
        this.model = new TridentModel();
    }
    
    @Override
    public void render(final ThrownTrident azk, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        cyl.pushPose();
        cyl.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(float3, azk.yRotO, azk.yRot) - 90.0f));
        cyl.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(float3, azk.xRotO, azk.xRot) + 90.0f));
        final VertexConsumer cyo8 = ItemRenderer.getFoilBuffer(dqt, this.model.renderType(this.getTextureLocation(azk)), false, azk.isFoil());
        this.model.renderToBuffer(cyl, cyo8, integer, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
        cyl.popPose();
        super.render(azk, float2, float3, cyl, dqt, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final ThrownTrident azk) {
        return ThrownTridentRenderer.TRIDENT_LOCATION;
    }
    
    static {
        TRIDENT_LOCATION = new ResourceLocation("textures/entity/trident.png");
    }
}
