package net.minecraft.client.renderer.entity;

import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.world.entity.projectile.ItemSupplier;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;

public class ThrownItemRenderer<T extends Entity> extends EntityRenderer<T> {
    private final ItemRenderer itemRenderer;
    private final float scale;
    private final boolean fullBright;
    
    public ThrownItemRenderer(final EntityRenderDispatcher dvf, final ItemRenderer dvz, final float float3, final boolean boolean4) {
        super(dvf);
        this.itemRenderer = dvz;
        this.scale = float3;
        this.fullBright = boolean4;
    }
    
    public ThrownItemRenderer(final EntityRenderDispatcher dvf, final ItemRenderer dvz) {
        this(dvf, dvz, 1.0f, false);
    }
    
    @Override
    protected int getBlockLightLevel(final T akq, final float float2) {
        return this.fullBright ? 15 : super.getBlockLightLevel(akq, float2);
    }
    
    @Override
    public void render(final T akq, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        cyl.pushPose();
        cyl.scale(this.scale, this.scale, this.scale);
        cyl.mulPose(this.entityRenderDispatcher.cameraOrientation());
        cyl.mulPose(Vector3f.YP.rotationDegrees(180.0f));
        this.itemRenderer.renderStatic(((ItemSupplier)akq).getItem(), ItemTransforms.TransformType.GROUND, integer, OverlayTexture.NO_OVERLAY, cyl, dqt);
        cyl.popPose();
        super.render(akq, float2, float3, cyl, dqt, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final Entity akq) {
        return TextureAtlas.LOCATION_BLOCKS;
    }
}
