Search in sources :

Example 1 with SourceMaskExtent

use of com.fastasyncworldedit.core.extent.SourceMaskExtent in project FastAsyncWorldEdit by IntellectualSites.

the class EditSession method setSourceMask.

// FAWE end
// FAWE start - use source mast > mask
/**
 * Set a mask.
 *
 * @param mask mask or null
 */
public void setSourceMask(Mask mask) {
    if (mask == null) {
        mask = Masks.alwaysTrue();
    } else {
        new MaskTraverser(mask).reset(this);
    }
    ExtentTraverser<SourceMaskExtent> maskingExtent = new ExtentTraverser<>(getExtent()).find(SourceMaskExtent.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()) {
        SourceMaskExtent next = new SourceMaskExtent(getExtent(), mask);
        new ExtentTraverser(this).setNext(next);
    }
}
Also used : ExtentTraverser(com.fastasyncworldedit.core.util.ExtentTraverser) 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) SourceMaskExtent(com.fastasyncworldedit.core.extent.SourceMaskExtent) MaskTraverser(com.fastasyncworldedit.core.util.MaskTraverser) ResettableMask(com.fastasyncworldedit.core.function.mask.ResettableMask)

Aggregations

SourceMaskExtent (com.fastasyncworldedit.core.extent.SourceMaskExtent)1 ResettableMask (com.fastasyncworldedit.core.function.mask.ResettableMask)1 SingleBlockTypeMask (com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask)1 WallMakeMask (com.fastasyncworldedit.core.function.mask.WallMakeMask)1 ExtentTraverser (com.fastasyncworldedit.core.util.ExtentTraverser)1 MaskTraverser (com.fastasyncworldedit.core.util.MaskTraverser)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