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

@ -79,17 +79,17 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
return mask.test(getExtent(), location) && super.setBlock(location, block);
return mask.test(location) && super.setBlock(location, block);
}
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
return mask.test(getExtent(), position.toBlockVector3()) && super.setBiome(position, biome);
return mask.test(position.toBlockVector3()) && super.setBiome(position, biome);
}
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
return mask.test(getExtent(), BlockVector3.at(x, y, z)) && super.setBiome(x, y, z, biome);
return mask.test(BlockVector3.at(x, y, z)) && super.setBiome(x, y, z, biome);
}
@Override
@ -102,7 +102,7 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce
public void applyBlock(FilterBlock block) {
//TODO: Find a way to make masking thread safe without having to synchonise the whole extent
synchronized (this) {
if (!mask.test(getExtent(), block)) {
if (!mask.test(block)) {
block.setOrdinal(0);
}
}