Class RandomPattern

java.lang.Object
com.sk89q.worldedit.function.pattern.AbstractPattern
com.sk89q.worldedit.function.pattern.RandomPattern
All Implemented Interfaces:
Filter, Pattern

public class RandomPattern extends AbstractPattern
Uses a random pattern of a weighted list of patterns.
  • Constructor Details

    • RandomPattern

      public RandomPattern()
    • RandomPattern

      public RandomPattern(SimpleRandom random)
    • RandomPattern

      public RandomPattern(SimpleRandom random, RandomPattern parent)
      Create a random pattern from an existing one but with a different random.
      Parameters:
      random - the new random to use.
      parent - the existing random pattern.
  • Method Details

    • add

      public void add(Pattern pattern, double chance)
      Add a pattern to the weight list of patterns.

      The probability for the pattern added is chance / max where max is the sum of the probabilities of all added patterns.

      Parameters:
      pattern - the pattern
      chance - the chance, which can be any positive number
    • getPatterns

      public Set<Pattern> getPatterns()
    • getCollection

      public RandomCollection<Pattern> getCollection()
    • applyBlock

      public BaseBlock applyBlock(BlockVector3 position)
      Description copied from interface: Pattern
      Return a BaseBlock for the given position.
      Parameters:
      position - the position
      Returns:
      a block
    • apply

      public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException
      Throws:
      WorldEditException
    • fork

      public Pattern fork()
      Description copied from interface: Filter
      Fork this for use by another thread - Typically filters are simple and don't need to create another copy to be thread safe here
      Returns:
      this