Class MultiBlockSelector
java.lang.Object
org.cloudburstmc.server.level.generator.standard.misc.selector.MultiBlockSelector
- All Implemented Interfaces:
BlockSelector
Implementation of
BlockSelector which selects a block from a pool of options.- Author:
- DaPorkchop_
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.cloudburstmc.server.level.generator.standard.misc.selector.BlockSelector
BlockSelector.Entry -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BlockSelector.Entry[]protected org.cloudburstmc.api.block.BlockState[]protected org.cloudburstmc.api.block.BlockState[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionentries()org.cloudburstmc.api.block.BlockStateget(int index)Gets theBlockStateat the given index.org.cloudburstmc.api.block.BlockStategetWeighted(int index)Gets theBlockStateat the given index, taking selection weights into account.org.cloudburstmc.api.block.BlockStateselect(@NonNull net.daporkchop.lib.random.PRandom random)Selects a randomBlockState.org.cloudburstmc.api.block.BlockStateselectWeighted(@NonNull net.daporkchop.lib.random.PRandom random)Selects a random block, taking selection weights into account.intsize()intStream<org.cloudburstmc.api.block.BlockState>states()
-
Field Details
-
states
protected final org.cloudburstmc.api.block.BlockState[] states -
statesWeighted
protected final org.cloudburstmc.api.block.BlockState[] statesWeighted -
entries
-
-
Constructor Details
-
MultiBlockSelector
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceBlockSelector- Returns:
- the total number of
BlockStates that this block selector can choose from
-
get
public org.cloudburstmc.api.block.BlockState get(int index)Description copied from interface:BlockSelectorGets theBlockStateat the given index.- Specified by:
getin interfaceBlockSelector- Parameters:
index- the index of theBlockStateto get- Returns:
- the
BlockStateat the given index
-
select
public org.cloudburstmc.api.block.BlockState select(@NonNull @NonNull net.daporkchop.lib.random.PRandom random)Description copied from interface:BlockSelectorSelects a randomBlockState.- Specified by:
selectin interfaceBlockSelector- Parameters:
random- the instance ofPRandomto use for generating random numbers- Returns:
- the selected
BlockState
-
states
- Specified by:
statesin interfaceBlockSelector- Returns:
- all of the
BlockStates that this instance can select from
-
sizeWeighted
public int sizeWeighted()- Specified by:
sizeWeightedin interfaceBlockSelector- Returns:
- the total number of
BlockStates that this block selector can choose from, taking selection weights into account
-
getWeighted
public org.cloudburstmc.api.block.BlockState getWeighted(int index)Description copied from interface:BlockSelectorGets theBlockStateat the given index, taking selection weights into account.- Specified by:
getWeightedin interfaceBlockSelector- Parameters:
index- the index of theBlockStateto get- Returns:
- the
BlockStateat the given index
-
selectWeighted
public org.cloudburstmc.api.block.BlockState selectWeighted(@NonNull @NonNull net.daporkchop.lib.random.PRandom random)Description copied from interface:BlockSelectorSelects a random block, taking selection weights into account.- Specified by:
selectWeightedin interfaceBlockSelector- Parameters:
random- the instance ofPRandomto use for generating random numbers- Returns:
- the selected
BlockState
-
entries
- Specified by:
entriesin interfaceBlockSelector- Returns:
- all of the
BlockStates that this instance can select from, taking selection weights into account
-