Class LayerVisitor
java.lang.Object
com.sk89q.worldedit.function.visitor.LayerVisitor
- All Implemented Interfaces:
Operation
Visits the layers within a region.
This class works by iterating over all the columns in a FlatRegion
,
finding the first ground block in each column (searching from a given
maximum Y down to a minimum Y), and then applies a LayerFunction
to
each layer.
-
Field Summary
Fields inherited from interface com.sk89q.worldedit.function.operation.Operation
warnedDeprecatedClasses
-
Constructor Summary
ConstructorDescriptionLayerVisitor
(FlatRegion flatRegion, int minY, int maxY, LayerFunction function) Create a new visitor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Abort the current task.getMask()
Get the mask that determines which columns within the flat region will be visited.resume
(RunContext run) Complete the next step.void
Set the mask that determines which columns within the flat region will be visited.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.function.operation.Operation
addStatusMessages, getStatusMessages
-
Constructor Details
-
LayerVisitor
Create a new visitor.- Parameters:
flatRegion
- the flat region to visitminY
- the minimum Y to stop the search atmaxY
- the maximum Y to begin the search atfunction
- the layer function to apply t blocks
-
-
Method Details
-
getMask
Get the mask that determines which columns within the flat region will be visited.- Returns:
- a 2D mask
-
setMask
Set the mask that determines which columns within the flat region will be visited.- Parameters:
mask
- a 2D mask
-
resume
Description copied from interface:Operation
Complete the next step. If this method returns true, then the method may be called again in the future, or possibly never. If this method returns false, then this method should not be called again.- Specified by:
resume
in interfaceOperation
- Parameters:
run
- describes information about the current run- Returns:
- another operation to run that operation again, or null to stop
- Throws:
WorldEditException
- an error
-
cancel
public void cancel()Description copied from interface:Operation
Abort the current task. After the this method is called,Operation.resume(RunContext)
should not be called at any point in the future. This method should not be called after successful completion of the operation. This method must be called if the operation is interrupted before completion.
-