Added FuzzyBlockMask(BaseBlock... block) constructor.

This commit is contained in:
sk89q 2014-03-27 20:47:01 -07:00
parent b21f944570
commit 8c3912b5e7

View File

@ -23,6 +23,7 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
/** /**
@ -42,6 +43,19 @@ public class FuzzyBlockMask extends AbstractMask {
this.filter = filter; this.filter = filter;
} }
/**
* Create a new fuzzy block mask.
*
* @param block a list of block types to match
*/
public FuzzyBlockMask(BaseBlock... block) {
Set<BaseBlock> filter = new HashSet<BaseBlock>();
for (BaseBlock b : block) {
filter.add(b);
}
this.filter = filter;
}
@Override @Override
public boolean matches(EditSession editSession, Vector pos) { public boolean matches(EditSession editSession, Vector pos) {
BaseBlock compare = new BaseBlock(editSession.getBlockType(pos), editSession.getBlockData(pos)); BaseBlock compare = new BaseBlock(editSession.getBlockType(pos), editSession.getBlockData(pos));