public class LayerVisitor extends java.lang.Object implements Operation
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.
warnedDeprecatedClasses
Constructor and Description |
---|
LayerVisitor(FlatRegion flatRegion,
int minY,
int maxY,
LayerFunction function)
Create a new visitor.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Abort the current task.
|
Mask2D |
getMask()
Get the mask that determines which columns within the flat region
will be visited.
|
Operation |
resume(RunContext run)
Complete the next step.
|
void |
setMask(Mask2D mask)
Set the mask that determines which columns within the flat region
will be visited.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStatusMessages, getStatusMessages
public LayerVisitor(FlatRegion flatRegion, int minY, int maxY, LayerFunction function)
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 blockspublic Mask2D getMask()
public void setMask(Mask2D mask)
mask
- a 2D maskpublic Operation resume(RunContext run) throws WorldEditException
Operation
resume
in interface Operation
run
- describes information about the current runWorldEditException
- an errorpublic void cancel()
Operation
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.