More work on masks (#607)

* Add a #air mask, the opposite of #existing (#1511)

(cherry picked from commit 84fa2bbbc63de7bece01f41c0d5cb7d85cf129e6)

* Remove unused methods in Mask.java

* Remove `test(Extent, BlockVector3)` from Masks.

This was a poorly planned idea. This should save some memory too.

Authored-by: Matthew Miller <mnmiller1@me.com>
This commit is contained in:
Matt
2020-09-11 15:13:31 -04:00
committed by GitHub
parent 1fa0777d3b
commit de199a0e59
78 changed files with 232 additions and 331 deletions

View File

@ -11,18 +11,11 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class SourceMaskExtent extends TemporalExtent {
private Mask mask;
private Extent get;
private MutableBlockVector3 mutable = new MutableBlockVector3();
public SourceMaskExtent(Extent extent, Mask mask) {
this(extent, extent, mask);
}
public SourceMaskExtent(Extent get, Extent set, Mask mask) {
super(set);
checkNotNull(get);
super(extent);
checkNotNull(mask);
this.get = get;
this.mask = mask;
}
@ -48,7 +41,7 @@ public class SourceMaskExtent extends TemporalExtent {
@Override
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
set(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
return mask.test(get, location) && super.setBlock(location, block);
return mask.test(location) && super.setBlock(location, block);
}
@Override
@ -57,6 +50,6 @@ public class SourceMaskExtent extends TemporalExtent {
mutable.mutX(x);
mutable.mutY(y);
mutable.mutZ(z);
return mask.test(get, mutable) && super.setBlock(x, y, z, block);
return mask.test(mutable) && super.setBlock(x, y, z, block);
}
}