Search in sources :

Example 1 with MaskingExtent

use of com.sk89q.worldedit.extent.MaskingExtent in project FastAsyncWorldEdit by IntellectualSites.

the class EditSession method setMask.

// FAWE end
// FAWE start - use MaskingExtent & ExtentTraverser
/**
 * Set a mask.
 *
 * @param mask mask or null
 */
public void setMask(Mask mask) {
    if (mask == null) {
        mask = Masks.alwaysTrue();
    } else {
        new MaskTraverser(mask).reset(this);
    }
    ExtentTraverser<MaskingExtent> maskingExtent = new ExtentTraverser<>(getExtent()).find(MaskingExtent.class);
    if (maskingExtent != null && maskingExtent.get() != null) {
        Mask oldMask = maskingExtent.get().getMask();
        if (oldMask instanceof ResettableMask) {
            ((ResettableMask) oldMask).reset();
        }
        maskingExtent.get().setMask(mask);
    } else if (mask != Masks.alwaysTrue()) {
        addProcessor(new MaskingExtent(getExtent(), mask));
    }
}
Also used : BlockTypeMask(com.sk89q.worldedit.function.mask.BlockTypeMask) SingleBlockTypeMask(com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask) RegionMask(com.sk89q.worldedit.function.mask.RegionMask) BlockStateMask(com.sk89q.worldedit.function.mask.BlockStateMask) WallMakeMask(com.fastasyncworldedit.core.function.mask.WallMakeMask) ExistingBlockMask(com.sk89q.worldedit.function.mask.ExistingBlockMask) BoundedHeightMask(com.sk89q.worldedit.function.mask.BoundedHeightMask) ResettableMask(com.fastasyncworldedit.core.function.mask.ResettableMask) Mask(com.sk89q.worldedit.function.mask.Mask) MaskTraverser(com.fastasyncworldedit.core.util.MaskTraverser) ResettableMask(com.fastasyncworldedit.core.function.mask.ResettableMask) MaskingExtent(com.sk89q.worldedit.extent.MaskingExtent)

Aggregations

ResettableMask (com.fastasyncworldedit.core.function.mask.ResettableMask)1 SingleBlockTypeMask (com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask)1 WallMakeMask (com.fastasyncworldedit.core.function.mask.WallMakeMask)1 MaskTraverser (com.fastasyncworldedit.core.util.MaskTraverser)1 MaskingExtent (com.sk89q.worldedit.extent.MaskingExtent)1 BlockStateMask (com.sk89q.worldedit.function.mask.BlockStateMask)1 BlockTypeMask (com.sk89q.worldedit.function.mask.BlockTypeMask)1 BoundedHeightMask (com.sk89q.worldedit.function.mask.BoundedHeightMask)1 ExistingBlockMask (com.sk89q.worldedit.function.mask.ExistingBlockMask)1 Mask (com.sk89q.worldedit.function.mask.Mask)1 RegionMask (com.sk89q.worldedit.function.mask.RegionMask)1