Class ArbitraryShape

java.lang.Object
com.sk89q.worldedit.regions.shape.ArbitraryShape
Direct Known Subclasses:
RegionShape

public abstract class ArbitraryShape extends Object
Generates solid and hollow shapes according to materials returned by the getMaterial(int, int, int, com.sk89q.worldedit.world.block.BaseBlock) method.
  • Field Details

    • extent

      protected final Region extent
  • Constructor Details

    • ArbitraryShape

      public ArbitraryShape(Region extent)
  • Method Details

    • getExtent

      protected Region getExtent()
    • getMaterial

      protected abstract BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial)
      Override this function to specify the shape to generate.
      Parameters:
      x - X coordinate to be queried
      y - Y coordinate to be queried
      z - Z coordinate to be queried
      defaultMaterial - The material returned by the pattern for the current block.
      Returns:
      material to place or null to not place anything.
    • generate

      public int generate(EditSession editSession, Pattern pattern, boolean hollow) throws MaxChangedBlocksException
      Generates the shape.
      Parameters:
      editSession - The EditSession to use.
      pattern - The pattern to generate default materials from.
      hollow - Specifies whether to generate a hollow shape.
      Returns:
      number of affected blocks.
      Throws:
      MaxChangedBlocksException - if the maximum blocks changed is exceeded