fix block mask inverse

This commit is contained in:
Jesse Boyd 2019-04-11 03:25:19 +10:00
parent 2e1b7676eb
commit 21be61f03a
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 9 additions and 8 deletions

View File

@ -212,15 +212,16 @@ public class BlockMask extends AbstractExtentMask {
@Override
public Mask inverse() {
for (int i = 0; i < bitSets.length; i++) {
if (bitSets[i] == null) bitSets[i] = ALL;
else if (bitSets[i] == ALL) bitSets[i] = null;
long[][] cloned = bitSets.clone();
for (int i = 0; i < cloned.length; i++) {
if (cloned[i] == null) cloned[i] = ALL;
else if (cloned[i] == ALL) cloned[i] = null;
else {
for (int j = 0; j < bitSets[i].length; j++)
bitSets[i][j] = ~bitSets[i][j];
for (int j = 0; j < cloned[i].length; j++)
cloned[i][j] = ~cloned[i][j];
}
}
return this;
return new BlockMask(getExtent(), cloned);
}
public boolean test(BlockState block) {

View File

@ -62,7 +62,7 @@ public class MaskIntersection extends AbstractMask {
if (masks.isEmpty()) {
masksArray = new Mask[]{Masks.alwaysFalse()};
} else {
masksArray = masks.toArray(new Mask[masks.size()]);
masksArray = masks.toArray(new Mask[0]);
}
}
@ -172,7 +172,7 @@ public class MaskIntersection extends AbstractMask {
return false;
}
for (Mask mask : masks) {
for (Mask mask : masksArray) {
if (!mask.test(vector)) {
return false;
}