package net.minecraft.client.renderer.chunk;

import java.util.Iterator;
import net.minecraft.core.Direction;
import java.util.Set;
import java.util.BitSet;

public class VisibilitySet {
    private static final int FACINGS;
    private final BitSet data;
    
    public VisibilitySet() {
        this.data = new BitSet(VisibilitySet.FACINGS * VisibilitySet.FACINGS);
    }
    
    public void add(final Set<Direction> set) {
        for (final Direction fp4 : set) {
            for (final Direction fp5 : set) {
                this.set(fp4, fp5, true);
            }
        }
    }
    
    public void set(final Direction fp1, final Direction fp2, final boolean boolean3) {
        this.data.set(fp1.ordinal() + fp2.ordinal() * VisibilitySet.FACINGS, boolean3);
        this.data.set(fp2.ordinal() + fp1.ordinal() * VisibilitySet.FACINGS, boolean3);
    }
    
    public void setAll(final boolean boolean1) {
        this.data.set(0, this.data.size(), boolean1);
    }
    
    public boolean visibilityBetween(final Direction fp1, final Direction fp2) {
        return this.data.get(fp1.ordinal() + fp2.ordinal() * VisibilitySet.FACINGS);
    }
    
    @Override
    public String toString() {
        final StringBuilder stringBuilder2 = new StringBuilder();
        stringBuilder2.append(' ');
        for (final Direction fp6 : Direction.values()) {
            stringBuilder2.append(' ').append(fp6.toString().toUpperCase().charAt(0));
        }
        stringBuilder2.append('\n');
        for (final Direction fp6 : Direction.values()) {
            stringBuilder2.append(fp6.toString().toUpperCase().charAt(0));
            for (final Direction fp7 : Direction.values()) {
                if (fp6 == fp7) {
                    stringBuilder2.append("  ");
                }
                else {
                    final boolean boolean11 = this.visibilityBetween(fp6, fp7);
                    stringBuilder2.append(' ').append(boolean11 ? 'Y' : 'n');
                }
            }
            stringBuilder2.append('\n');
        }
        return stringBuilder2.toString();
    }
    
    static {
        FACINGS = Direction.values().length;
    }
}
