59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.renderer.chunk;
|
|
|
|
import java.util.BitSet;
|
|
import java.util.Locale;
|
|
import java.util.Set;
|
|
import net.minecraft.core.Direction;
|
|
|
|
public class VisibilitySet {
|
|
private static final int FACINGS = Direction.values().length;
|
|
private final BitSet data = new BitSet(FACINGS * FACINGS);
|
|
|
|
public void add(Set<Direction> directions) {
|
|
for (Direction direction1 : directions) {
|
|
for (Direction direction2 : directions) {
|
|
this.set(direction1, direction2, true);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void set(Direction direction1, Direction direction2, boolean value) {
|
|
this.data.set(direction1.ordinal() + direction2.ordinal() * FACINGS, value);
|
|
this.data.set(direction2.ordinal() + direction1.ordinal() * FACINGS, value);
|
|
}
|
|
|
|
public void setAll(boolean visible) {
|
|
this.data.set(0, this.data.size(), visible);
|
|
}
|
|
|
|
public boolean visibilityBetween(Direction direction1, Direction direction2) {
|
|
return this.data.get(direction1.ordinal() + direction2.ordinal() * FACINGS);
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder builder = new StringBuilder();
|
|
builder.append(' ');
|
|
for (Direction direction : Direction.values()) {
|
|
builder.append(' ').append(direction.toString().toUpperCase(Locale.ROOT).charAt(0));
|
|
}
|
|
builder.append('\n');
|
|
for (Direction direction1 : Direction.values()) {
|
|
builder.append(direction1.toString().toUpperCase(Locale.ROOT).charAt(0));
|
|
for (Direction direction2 : Direction.values()) {
|
|
if (direction1 == direction2) {
|
|
builder.append(" ");
|
|
continue;
|
|
}
|
|
boolean ok = this.visibilityBetween(direction1, direction2);
|
|
builder.append(' ').append(ok ? (char)'Y' : 'n');
|
|
}
|
|
builder.append('\n');
|
|
}
|
|
return builder.toString();
|
|
}
|
|
}
|
|
|