package net.minecraft.client.renderer.debug;

import net.minecraft.client.Camera;
import java.util.Iterator;
import net.minecraft.core.Vec3i;
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.Collection;
import net.minecraft.client.Minecraft;

public class RaidDebugRenderer implements DebugRenderer.SimpleDebugRenderer {
    private final Minecraft minecraft;
    private Collection<BlockPos> raidCenters;
    
    public RaidDebugRenderer(final Minecraft dlx) {
        this.raidCenters = Lists.newArrayList();
        this.minecraft = dlx;
    }
    
    public void setRaidCenters(final Collection<BlockPos> collection) {
        this.raidCenters = collection;
    }
    
    @Override
    public void render(final PoseStack dhl, final MultiBufferSource ebz, final double double3, final double double4, final double double5) {
        final BlockPos fu10 = this.getCamera().getBlockPosition();
        for (final BlockPos fu11 : this.raidCenters) {
            if (fu10.closerThan(fu11, 160.0)) {
                highlightRaidCenter(fu11);
            }
        }
    }
    
    private static void highlightRaidCenter(final BlockPos fu) {
        DebugRenderer.renderFilledBox(fu.offset(-0.5, -0.5, -0.5), fu.offset(1.5, 1.5, 1.5), 1.0f, 0.0f, 0.0f, 0.15f);
        final int integer2 = -65536;
        renderTextOverBlock("Raid center", fu, -65536);
    }
    
    private static void renderTextOverBlock(final String string, final BlockPos fu, final int integer) {
        final double double4 = fu.getX() + 0.5;
        final double double5 = fu.getY() + 1.3;
        final double double6 = fu.getZ() + 0.5;
        DebugRenderer.renderFloatingText(string, double4, double5, double6, integer, 0.04f, true, 0.0f, true);
    }
    
    private Camera getCamera() {
        return this.minecraft.gameRenderer.getMainCamera();
    }
}
