Class ConstantBlock
java.lang.Object
org.cloudburstmc.server.level.generator.standard.misc.ConstantBlock
- All Implemented Interfaces:
Predicate<org.cloudburstmc.api.block.BlockState>,BlockFilter,BlockSelector,BlockSelector.Entry
public final class ConstantBlock
extends Object
implements BlockFilter, BlockSelector, BlockSelector.Entry
Represents a constant block configuration option.
- Author:
- DaPorkchop_
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudburstmc.server.level.generator.standard.misc.selector.BlockSelector
BlockSelector.Entry -
Field Summary
Fields inherited from interface org.cloudburstmc.server.level.generator.standard.misc.filter.BlockFilter
AIR, REPLACEABLE -
Constructor Summary
ConstructorsConstructorDescriptionConstantBlock(String value)ConstantBlock(org.cloudburstmc.api.util.Identifier id, int meta) -
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(net.daporkchop.lib.random.PRandom random)Selects a randomBlockState.org.cloudburstmc.api.block.BlockStateselectWeighted(net.daporkchop.lib.random.PRandom random)Selects a random block, taking selection weights into account.intsize()intorg.cloudburstmc.api.block.BlockStatestate()Stream<org.cloudburstmc.api.block.BlockState>states()booleantest(org.cloudburstmc.api.block.BlockState state)intweight()
-
Constructor Details
-
ConstantBlock
public ConstantBlock(org.cloudburstmc.api.util.Identifier id, int meta) -
ConstantBlock
-
-
Method Details
-
state
public org.cloudburstmc.api.block.BlockState state()- Specified by:
statein interfaceBlockSelector.Entry- Returns:
- the
BlockStateused by this entry
-
test
public boolean test(org.cloudburstmc.api.block.BlockState state)- Specified by:
testin interfaceBlockFilter- Specified by:
testin interfacePredicate<org.cloudburstmc.api.block.BlockState>
-
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(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(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
-
weight
public int weight()- Specified by:
weightin interfaceBlockSelector.Entry- Returns:
- this entry's random selection weight
-