Plex-FAWE/worldedit-core/src/main/java/com/boydti/fawe/object/mask/SurfaceMask.java
N0tMyFaultOG bfcc6184ad Revert matt's changes
Let's not break Fawe, thanks
2020-06-13 18:48:57 +02:00

25 lines
860 B
Java

package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockTypes;
public class SurfaceMask extends AdjacentAnyMask {
public SurfaceMask(Extent extent) {
super(getMask(extent));
}
public static Mask getMask(Extent extent) {
return new BlockMaskBuilder()
.addTypes(BlockTypes.AIR, BlockTypes.CAVE_AIR, BlockTypes.VOID_AIR)
.addAll(b -> !b.getMaterial().isMovementBlocker())
.build(extent);
}
@Override
public boolean test(Extent extent, BlockVector3 v) {
return !getParentMask().test(extent, v.getBlockX(), v.getBlockY(), v.getBlockZ()) && super.test(extent, v);
}
}