Class GroundFunction

java.lang.Object
com.sk89q.worldedit.function.GroundFunction
All Implemented Interfaces:
LayerFunction

public class GroundFunction extends Object implements LayerFunction
Applies a RegionFunction to the first ground block.
  • Constructor Details

    • GroundFunction

      public GroundFunction(Mask mask, RegionFunction function)
      Create a new ground function.
      Parameters:
      mask - a mask
      function - the function to apply
  • Method Details

    • getMask

      public Mask getMask()
      Get the mask that determines what the ground consists of.
      Returns:
      a mask
    • setMask

      public void setMask(Mask mask)
      Set the mask that determines what the ground consists of.
      Parameters:
      mask - a mask
    • getAffected

      public int getAffected()
      Get the number of affected objects.
      Returns:
      the number of affected
    • isGround

      public boolean isGround(BlockVector3 position)
      Description copied from interface: LayerFunction
      Returns whether the given block should be "passed through" when conducting the ground search.
      Specified by:
      isGround in interface LayerFunction
      Parameters:
      position - return whether the given block is the ground
      Returns:
      true if the search should stop
    • apply

      public boolean apply(BlockVector3 position, int depth) throws WorldEditException
      Description copied from interface: LayerFunction
      Apply the function to the given position.

      The depth would be the number of blocks from the surface if a LayerVisitor was used.

      Specified by:
      apply in interface LayerFunction
      Parameters:
      position - the position
      depth - the depth as a number starting from 0
      Returns:
      true whether this method should be called for further layers
      Throws:
      WorldEditException - thrown on an error