Added a SolidBlockMask (#solid).

This commit is contained in:
TomyLobo 2013-10-29 08:04:52 +01:00
parent 02de320980
commit 627e029fbb
2 changed files with 18 additions and 0 deletions

View File

@ -84,6 +84,7 @@
import com.sk89q.worldedit.masks.Mask;
import com.sk89q.worldedit.masks.RandomMask;
import com.sk89q.worldedit.masks.RegionMask;
import com.sk89q.worldedit.masks.SolidBlockMask;
import com.sk89q.worldedit.masks.UnderOverlayMask;
import com.sk89q.worldedit.patterns.BlockChance;
import com.sk89q.worldedit.patterns.ClipboardPattern;
@ -731,6 +732,8 @@ private Mask getBlockMaskComponent(LocalPlayer player, LocalSession session, Lis
case '#':
if (component.equalsIgnoreCase("#existing")) {
return new ExistingBlockMask();
} else if (component.equalsIgnoreCase("#solid")) {
return new SolidBlockMask();
} else if (component.equalsIgnoreCase("#dregion")
|| component.equalsIgnoreCase("#dselection")
|| component.equalsIgnoreCase("#dsel")) {

View File

@ -0,0 +1,15 @@
package com.sk89q.worldedit.masks;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BlockType;
/**
* Works like {@link ExistingBlockMask}, except also dealing with non-solid non-air blocks the same way as with air.
*/
public class SolidBlockMask extends AbstractMask {
@Override
public boolean matches(EditSession editSession, Vector pos) {
return !BlockType.canPassThrough(editSession.getBlockType(pos), editSession.getBlockData(pos));
}
}