3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Make surface brush not replacing the whole world

Dieser Commit ist enthalten in:
Hannes Greule 2020-07-06 02:29:34 +02:00
Ursprung ed6f3e7b4a
Commit 6fb10c3879

Datei anzeigen

@ -5,13 +5,14 @@ import com.boydti.fawe.object.mask.SurfaceMask;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.function.mask.MaskUnion; import com.sk89q.worldedit.function.mask.MaskIntersection;
import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch; import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import java.util.Arrays; import java.util.Arrays;
public class SurfaceSphereBrush implements Brush { public class SurfaceSphereBrush implements Brush {
@ -20,7 +21,7 @@ public class SurfaceSphereBrush implements Brush {
SurfaceMask surface = new SurfaceMask(editSession); SurfaceMask surface = new SurfaceMask(editSession);
final SolidBlockMask solid = new SolidBlockMask(editSession); final SolidBlockMask solid = new SolidBlockMask(editSession);
final RadiusMask radius = new RadiusMask(0, (int) size); final RadiusMask radius = new RadiusMask(0, (int) size);
RecursiveVisitor visitor = new RecursiveVisitor(new MaskUnion(surface, radius).withExtent(editSession), vector -> editSession.setBlock(vector, pattern)); RecursiveVisitor visitor = new RecursiveVisitor(new MaskIntersection(surface, radius).withExtent(editSession), vector -> editSession.setBlock(vector, pattern));
visitor.visit(position); visitor.visit(position);
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS)); visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
Operations.completeBlindly(visitor); Operations.completeBlindly(visitor);