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 egm) {
        super(egm);
        this.model = new TridentModel();
    }
    
    @Override
    public void render(final ThrownTrident bfe, final float float2, final float float3, final PoseStack dhl, final MultiBufferSource ebz, final int integer) {
        dhl.pushPose();
        dhl.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(float3, bfe.yRotO, bfe.yRot) - 90.0f));
        dhl.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(float3, bfe.xRotO, bfe.xRot) + 90.0f));
        final VertexConsumer dhp8 = ItemRenderer.getFoilBufferDirect(ebz, this.model.renderType(this.getTextureLocation(bfe)), false, bfe.isFoil());
        this.model.renderToBuffer(dhl, dhp8, integer, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
        dhl.popPose();
        super.render(bfe, float2, float3, dhl, ebz, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final ThrownTrident bfe) {
        return ThrownTridentRenderer.TRIDENT_LOCATION;
    }
    
    static {
        TRIDENT_LOCATION = new ResourceLocation("textures/entity/trident.png");
    }
}
