Class LayerVisitor

java.lang.Object
com.sk89q.worldedit.function.visitor.LayerVisitor
All Implemented Interfaces:
Operation

public class LayerVisitor extends Object implements 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.

  • Constructor Details

    • LayerVisitor

      public LayerVisitor(FlatRegion flatRegion, int minY, int maxY, LayerFunction function)
      Create a new visitor.
      Parameters:
      flatRegion - the flat region to visit
      minY - the minimum Y to stop the search at
      maxY - the maximum Y to begin the search at
      function - the layer function to apply t blocks
  • Method Details

    • getMask

      public Mask2D getMask()
      Get the mask that determines which columns within the flat region will be visited.
      Returns:
      a 2D mask
    • setMask

      public void setMask(Mask2D mask)
      Set the mask that determines which columns within the flat region will be visited.
      Parameters:
      mask - a 2D mask
    • resume

      public Operation resume(RunContext run) throws WorldEditException
      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 interface Operation
      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.
      Specified by:
      cancel in interface Operation