package net.minecraft.client.renderer.debug;

import net.minecraft.core.Vec3i;
import net.minecraft.core.BlockPos;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import com.google.common.collect.Sets;
import net.minecraft.core.SectionPos;
import java.util.Set;

public class VillageSectionsDebugRenderer implements DebugRenderer.SimpleDebugRenderer {
    private final Set<SectionPos> villageSections;
    
    VillageSectionsDebugRenderer() {
        this.villageSections = Sets.newHashSet();
    }
    
    @Override
    public void clear() {
        this.villageSections.clear();
    }
    
    public void setVillageSection(final SectionPos go) {
        this.villageSections.add(go);
    }
    
    public void setNotVillageSection(final SectionPos go) {
        this.villageSections.remove(go);
    }
    
    @Override
    public void render(final PoseStack dhl, final MultiBufferSource ebz, final double double3, final double double4, final double double5) {
        RenderSystem.pushMatrix();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        RenderSystem.disableTexture();
        this.doRender(double3, double4, double5);
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();
        RenderSystem.popMatrix();
    }
    
    private void doRender(final double double1, final double double2, final double double3) {
        final BlockPos fu8 = new BlockPos(double1, double2, double3);
        this.villageSections.forEach(go -> {
            if (fu8.closerThan(go.center(), 60.0)) {
                highlightVillageSection(go);
            }
        });
    }
    
    private static void highlightVillageSection(final SectionPos go) {
        final float float2 = 1.0f;
        final BlockPos fu3 = go.center();
        final BlockPos fu4 = fu3.offset(-1.0, -1.0, -1.0);
        final BlockPos fu5 = fu3.offset(1.0, 1.0, 1.0);
        DebugRenderer.renderFilledBox(fu4, fu5, 0.2f, 1.0f, 0.2f, 0.15f);
    }
}
