package net.minecraft.client.renderer.entity;

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

public class FireworkEntityRenderer extends EntityRenderer<FireworkRocketEntity> {
    private final ItemRenderer itemRenderer;
    
    public FireworkEntityRenderer(final EntityRenderDispatcher dvf, final ItemRenderer dvz) {
        super(dvf);
        this.itemRenderer = dvz;
    }
    
    @Override
    public void render(final FireworkRocketEntity ayu, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        cyl.pushPose();
        cyl.mulPose(this.entityRenderDispatcher.cameraOrientation());
        cyl.mulPose(Vector3f.YP.rotationDegrees(180.0f));
        if (ayu.isShotAtAngle()) {
            cyl.mulPose(Vector3f.ZP.rotationDegrees(180.0f));
            cyl.mulPose(Vector3f.YP.rotationDegrees(180.0f));
            cyl.mulPose(Vector3f.XP.rotationDegrees(90.0f));
        }
        this.itemRenderer.renderStatic(ayu.getItem(), ItemTransforms.TransformType.GROUND, integer, OverlayTexture.NO_OVERLAY, cyl, dqt);
        cyl.popPose();
        super.render(ayu, float2, float3, cyl, dqt, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final FireworkRocketEntity ayu) {
        return TextureAtlas.LOCATION_BLOCKS;
    }
}
