mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-10-25 20:32:24 +00:00
Add convenient methods for fast IAlignmentLimits creation
This commit is contained in:
1 parent
8975c149c0
commit
307c068db9
1 file changed
+18
@@ -23,9 +23,27 @@ public interface IAlignmentLimits {
|
||||
alignment.getFlip());
|
||||
}
|
||||
|
||||
static IAlignmentLimits allowOnly(ExtendedFacing... allowedFacings) {
|
||||
Builder builder = Builder.denyAll();
|
||||
for (ExtendedFacing allowedFacing : allowedFacings) {
|
||||
builder.allow(allowedFacing);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
static IAlignmentLimits denyOnly(ExtendedFacing... allowedFacings) {
|
||||
Builder builder = Builder.allowAll();
|
||||
for (ExtendedFacing allowedFacing : allowedFacings) {
|
||||
builder.deny(allowedFacing);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
class Builder {
|
||||
protected final boolean[] validStates = new boolean[STATES_COUNT];
|
||||
|
||||
private Builder() {}
|
||||
|
||||
public static Builder allowAll() {
|
||||
Builder b = new Builder();
|
||||
Arrays.fill(b.validStates, true);
|
||||
|
||||
Reference in new issue
Block a user