public final class MultiBlockSelector extends Object implements BlockSelector
BlockSelector which selects a block from a pool of options.| Modifier and Type | Class and Description |
|---|---|
static class |
MultiBlockSelector.SelectionEntry |
BlockSelector.Entry| Modifier and Type | Field and Description |
|---|---|
protected BlockSelector.Entry[] |
entries |
protected BlockState[] |
states |
protected BlockState[] |
statesWeighted |
| Constructor and Description |
|---|
MultiBlockSelector(@NonNull BlockSelector.Entry[] entries) |
| Modifier and Type | Method and Description |
|---|---|
Stream<BlockSelector.Entry> |
entries() |
BlockState |
get(int index)
Gets the
BlockState at the given index. |
BlockState |
getWeighted(int index)
Gets the
BlockState at the given index, taking selection weights into account. |
BlockState |
select(@NonNull net.daporkchop.lib.random.PRandom random)
Selects a random
BlockState. |
BlockState |
selectWeighted(@NonNull net.daporkchop.lib.random.PRandom random)
Selects a random block, taking selection weights into account.
|
int |
size() |
int |
sizeWeighted() |
Stream<BlockState> |
states() |
protected final BlockState[] states
protected final BlockState[] statesWeighted
protected final BlockSelector.Entry[] entries
public MultiBlockSelector(@NonNull
@NonNull BlockSelector.Entry[] entries)
public int size()
size in interface BlockSelectorBlockStates that this block selector can choose frompublic BlockState get(int index)
BlockSelectorBlockState at the given index.get in interface BlockSelectorindex - the index of the BlockState to getBlockState at the given indexpublic BlockState select(@NonNull @NonNull net.daporkchop.lib.random.PRandom random)
BlockSelectorBlockState.select in interface BlockSelectorrandom - the instance of PRandom to use for generating random numbersBlockStatepublic Stream<BlockState> states()
states in interface BlockSelectorBlockStates that this instance can select frompublic int sizeWeighted()
sizeWeighted in interface BlockSelectorBlockStates that this block selector can choose from, taking selection weights into accountpublic BlockState getWeighted(int index)
BlockSelectorBlockState at the given index, taking selection weights into account.getWeighted in interface BlockSelectorindex - the index of the BlockState to getBlockState at the given indexpublic BlockState selectWeighted(@NonNull @NonNull net.daporkchop.lib.random.PRandom random)
BlockSelectorselectWeighted in interface BlockSelectorrandom - the instance of PRandom to use for generating random numbersBlockStatepublic Stream<BlockSelector.Entry> entries()
entries in interface BlockSelectorBlockStates that this instance can select from, taking selection weights into accountCopyright © 2020. All rights reserved.