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
ConstructorDescriptionRandomPattern
(SimpleRandom random) RandomPattern
(SimpleRandom random, RandomPattern parent) Create a random pattern from an existing one but with a different random. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a pattern to the weight list of patterns.boolean
apply
(Extent extent, BlockVector3 get, BlockVector3 set) applyBlock
(BlockVector3 position) Return aBaseBlock
for 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, wait
Methods inherited from interface com.fastasyncworldedit.core.queue.Filter
applyChunk, finishChunk, join
Methods 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:Pattern
Return aBaseBlock
for the given position.- Parameters:
position
- the position- Returns:
- a block
-
apply
- Throws:
WorldEditException
-
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
-