package net.minecraft.client.renderer.entity;

import net.minecraft.world.entity.Entity;
import net.minecraft.client.renderer.texture.OverlayTexture;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.DragonFireball;

public class DragonFireballRenderer extends EntityRenderer<DragonFireball> {
    private static final ResourceLocation TEXTURE_LOCATION;
    private static final RenderType RENDER_TYPE;
    
    public DragonFireballRenderer(final EntityRenderDispatcher dvf) {
        super(dvf);
    }
    
    @Override
    protected int getBlockLightLevel(final DragonFireball ayq, final float float2) {
        return 15;
    }
    
    @Override
    public void render(final DragonFireball ayq, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        cyl.pushPose();
        cyl.scale(2.0f, 2.0f, 2.0f);
        cyl.mulPose(this.entityRenderDispatcher.cameraOrientation());
        cyl.mulPose(Vector3f.YP.rotationDegrees(180.0f));
        final PoseStack.Pose a8 = cyl.last();
        final Matrix4f b9 = a8.pose();
        final Matrix3f a9 = a8.normal();
        final VertexConsumer cyo11 = dqt.getBuffer(DragonFireballRenderer.RENDER_TYPE);
        vertex(cyo11, b9, a9, integer, 0.0f, 0, 0, 1);
        vertex(cyo11, b9, a9, integer, 1.0f, 0, 1, 1);
        vertex(cyo11, b9, a9, integer, 1.0f, 1, 1, 0);
        vertex(cyo11, b9, a9, integer, 0.0f, 1, 0, 0);
        cyl.popPose();
        super.render(ayq, float2, float3, cyl, dqt, integer);
    }
    
    private static void vertex(final VertexConsumer cyo, final Matrix4f b, final Matrix3f a, final int integer4, final float float5, final int integer6, final int integer7, final int integer8) {
        cyo.vertex(b, float5 - 0.5f, integer6 - 0.25f, 0.0f).color(255, 255, 255, 255).uv((float)integer7, (float)integer8).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(integer4).normal(a, 0.0f, 1.0f, 0.0f).endVertex();
    }
    
    @Override
    public ResourceLocation getTextureLocation(final DragonFireball ayq) {
        return DragonFireballRenderer.TEXTURE_LOCATION;
    }
    
    static {
        TEXTURE_LOCATION = new ResourceLocation("textures/entity/enderdragon/dragon_fireball.png");
        RENDER_TYPE = RenderType.entityCutoutNoCull(DragonFireballRenderer.TEXTURE_LOCATION);
    }
}
