Class RandomPattern
java.lang.Object
com.sk89q.worldedit.function.pattern.AbstractPattern
com.sk89q.worldedit.function.pattern.RandomPattern
Uses a random pattern of a weighted list of patterns.
-
Constructor Summary
ConstructorsConstructorDescriptionRandomPattern(SimpleRandom random) RandomPattern(SimpleRandom random, RandomPattern parent) Create a random pattern from an existing one but with a different random. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a pattern to the weight list of patterns.booleanapply(Extent extent, BlockVector3 get, BlockVector3 set) applyBlock(BlockVector3 position) Return aBaseBlockfor the given position.fork()Fork this for use by another thread - Typically filters are simple and don't need to create another copy to be thread safe hereMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.fastasyncworldedit.core.queue.Filter
applyChunk, finish, finishChunk, joinMethods inherited from interface com.sk89q.worldedit.function.pattern.Pattern
apply, applyBlock, size
-
Constructor Details
-
RandomPattern
public RandomPattern() -
RandomPattern
-
RandomPattern
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
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 patternchance- the chance, which can be any positive number
-
getPatterns
-
getCollection
-
applyBlock
Description copied from interface:PatternReturn aBaseBlockfor the given position.- Parameters:
position- the position- Returns:
- a block
-
apply
- Throws:
WorldEditException
-
fork
Description copied from interface:FilterFork 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
-