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 dbn) {
        this.raidCenters = Lists.newArrayList();
        this.minecraft = dbn;
    }
    
    public void setRaidCenters(final Collection<BlockPos> collection) {
        this.raidCenters = collection;
    }
    
    @Override
    public void render(final PoseStack cyl, final MultiBufferSource dqt, final double double3, final double double4, final double double5) {
        final BlockPos fk10 = this.getCamera().getBlockPosition();
        for (final BlockPos fk11 : this.raidCenters) {
            if (fk10.closerThan(fk11, 160.0)) {
                highlightRaidCenter(fk11);
            }
        }
    }
    
    private static void highlightRaidCenter(final BlockPos fk) {
        DebugRenderer.renderFilledBox(fk.offset(-0.5, -0.5, -0.5), fk.offset(1.5, 1.5, 1.5), 1.0f, 0.0f, 0.0f, 0.15f);
        final int integer2 = -65536;
        renderTextOverBlock("Raid center", fk, -65536);
    }
    
    private static void renderTextOverBlock(final String string, final BlockPos fk, final int integer) {
        final double double4 = fk.getX() + 0.5;
        final double double5 = fk.getY() + 1.3;
        final double double6 = fk.getZ() + 0.5;
        DebugRenderer.renderFloatingText(string, double4, double5, double6, integer, 0.04f, true, 0.0f, true);
    }
    
    private Camera getCamera() {
        return this.minecraft.gameRenderer.getMainCamera();
    }
}
