Search in sources :

Example 1 with SplatterBrushMask

use of com.fastasyncworldedit.core.function.mask.SplatterBrushMask in project FastAsyncWorldEdit by IntellectualSites.

the class SplatterBrush method apply.

@Override
public void apply(final EditSession editSession, final LocalBlockVectorSet placed, final BlockVector3 position, Pattern p, double size) throws MaxChangedBlocksException {
    final Pattern finalPattern;
    if (solid) {
        finalPattern = p.applyBlock(position);
    } else {
        finalPattern = p;
    }
    final int size2 = (int) (size * size);
    SurfaceMask surface = new SurfaceMask(editSession);
    RecursiveVisitor visitor = new RecursiveVisitor(new SplatterBrushMask(editSession, position, size2, surface, placed), vector -> editSession.setBlock(vector, finalPattern), recursion, editSession.getMinY(), editSession.getMaxY());
    visitor.setMaxBranch(2);
    visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
    visitor.visit(position);
    Operations.completeBlindly(visitor);
}
Also used : Pattern(com.sk89q.worldedit.function.pattern.Pattern) RecursiveVisitor(com.sk89q.worldedit.function.visitor.RecursiveVisitor) SplatterBrushMask(com.fastasyncworldedit.core.function.mask.SplatterBrushMask) SurfaceMask(com.fastasyncworldedit.core.function.mask.SurfaceMask)

Aggregations

SplatterBrushMask (com.fastasyncworldedit.core.function.mask.SplatterBrushMask)1 SurfaceMask (com.fastasyncworldedit.core.function.mask.SurfaceMask)1 Pattern (com.sk89q.worldedit.function.pattern.Pattern)1 RecursiveVisitor (com.sk89q.worldedit.function.visitor.RecursiveVisitor)1