This commit is contained in:
dordsor21
2020-09-21 17:09:17 +01:00
parent 3b2fe2ffde
commit 3b660756f6
17 changed files with 84 additions and 17 deletions

View File

@ -15,6 +15,10 @@ public abstract class ABlockMask extends AbstractExtentMask {
super(extent);
}
@Override public boolean test(Extent extent, BlockVector3 vector) {
return test(extent.getBlock(vector));
}
@Override public boolean test(BlockVector3 vector) {
return test(getExtent().getBlock(vector));
}

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import static com.google.common.base.Preconditions.checkNotNull;
@ -59,4 +60,6 @@ public abstract class AbstractExtentMask extends AbstractMask {
this.extent = extent;
}
abstract public boolean test(Extent extent, BlockVector3 position);
}

View File

@ -46,6 +46,11 @@ public class BlockCategoryMask extends AbstractExtentMask {
return category.contains(getExtent().getBlock(vector));
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return category.contains(extent.getBlock(vector));
}
@Nullable
@Override
public Mask2D toMask2D() {

View File

@ -57,6 +57,11 @@ public class BlockStateMask extends AbstractExtentMask {
return test(getExtent().getBlock(vector));
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return test(extent.getBlock(vector));
}
public boolean test(BlockState block) {
final Map<Property<Object>, Object> checkProps = cache
.computeIfAbsent(block.getBlockType(), (b -> Blocks.resolveProperties(states, b)));

View File

@ -114,6 +114,11 @@ public class BlockTypeMask extends AbstractExtentMask {
return test(getExtent().getBlock(vector).getBlockType());
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return test(extent.getBlock(vector).getBlockType());
}
@Override
public boolean replacesAir() {
return hasAir;

View File

@ -1,11 +0,0 @@
package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
public class DelegateExtentMask extends AbstractDelegateMask {
public DelegateExtentMask(Mask parent) {
super(parent);
}
}

View File

@ -44,6 +44,11 @@ public class ExistingBlockMask extends AbstractExtentMask {
return !getExtent().getBlock(vector).getBlockType().getMaterial().isAir();
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return !extent.getBlock(vector).getBlockType().getMaterial().isAir();
}
@Nullable
@Override
public Mask2D toMask2D() {

View File

@ -1,6 +1,7 @@
package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;