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 fz4 : set) {
            for (final Direction fz5 : set) {
                this.set(fz4, fz5, true);
            }
        }
    }
    
    public void set(final Direction fz1, final Direction fz2, final boolean boolean3) {
        this.data.set(fz1.ordinal() + fz2.ordinal() * VisibilitySet.FACINGS, boolean3);
        this.data.set(fz2.ordinal() + fz1.ordinal() * VisibilitySet.FACINGS, boolean3);
    }
    
    public void setAll(final boolean boolean1) {
        this.data.set(0, this.data.size(), boolean1);
    }
    
    public boolean visibilityBetween(final Direction fz1, final Direction fz2) {
        return this.data.get(fz1.ordinal() + fz2.ordinal() * VisibilitySet.FACINGS);
    }
    
    @Override
    public String toString() {
        final StringBuilder stringBuilder2 = new StringBuilder();
        stringBuilder2.append(' ');
        for (final Direction fz6 : Direction.values()) {
            stringBuilder2.append(' ').append(fz6.toString().toUpperCase().charAt(0));
        }
        stringBuilder2.append('\n');
        for (final Direction fz6 : Direction.values()) {
            stringBuilder2.append(fz6.toString().toUpperCase().charAt(0));
            for (final Direction fz7 : Direction.values()) {
                if (fz6 == fz7) {
                    stringBuilder2.append("  ");
                }
                else {
                    final boolean boolean11 = this.visibilityBetween(fz6, fz7);
                    stringBuilder2.append(' ').append(boolean11 ? 'Y' : 'n');
                }
            }
            stringBuilder2.append('\n');
        }
        return stringBuilder2.toString();
    }
    
    static {
        FACINGS = Direction.values().length;
    }
}
