package net.minecraft.client.renderer.debug;

import com.mojang.blaze3d.vertex.BufferBuilder;
import net.minecraft.client.renderer.LevelRenderer;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import com.google.common.collect.Lists;
import net.minecraft.core.BlockPos;
import java.util.List;

public class WorldGenAttemptRenderer implements DebugRenderer.SimpleDebugRenderer {
    private final List<BlockPos> toRender;
    private final List<Float> scales;
    private final List<Float> alphas;
    private final List<Float> reds;
    private final List<Float> greens;
    private final List<Float> blues;
    
    public WorldGenAttemptRenderer() {
        this.toRender = Lists.newArrayList();
        this.scales = Lists.newArrayList();
        this.alphas = Lists.newArrayList();
        this.reds = Lists.newArrayList();
        this.greens = Lists.newArrayList();
        this.blues = Lists.newArrayList();
    }
    
    public void addPos(final BlockPos fk, final float float2, final float float3, final float float4, final float float5, final float float6) {
        this.toRender.add(fk);
        this.scales.add(float2);
        this.alphas.add(float6);
        this.reds.add(float3);
        this.greens.add(float4);
        this.blues.add(float5);
    }
    
    @Override
    public void render(final PoseStack cyl, final MultiBufferSource dqt, final double double3, final double double4, final double double5) {
        RenderSystem.pushMatrix();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        RenderSystem.disableTexture();
        final Tesselator cym10 = Tesselator.getInstance();
        final BufferBuilder cyg11 = cym10.getBuilder();
        cyg11.begin(5, DefaultVertexFormat.POSITION_COLOR);
        for (int integer12 = 0; integer12 < this.toRender.size(); ++integer12) {
            final BlockPos fk13 = this.toRender.get(integer12);
            final Float float14 = this.scales.get(integer12);
            final float float15 = float14 / 2.0f;
            LevelRenderer.addChainedFilledBoxVertices(cyg11, fk13.getX() + 0.5f - float15 - double3, fk13.getY() + 0.5f - float15 - double4, fk13.getZ() + 0.5f - float15 - double5, fk13.getX() + 0.5f + float15 - double3, fk13.getY() + 0.5f + float15 - double4, fk13.getZ() + 0.5f + float15 - double5, this.reds.get(integer12), this.greens.get(integer12), this.blues.get(integer12), this.alphas.get(integer12));
        }
        cym10.end();
        RenderSystem.enableTexture();
        RenderSystem.popMatrix();
    }
}
