Class WeightedBlockStateProvider
java.lang.Object
com.github.darksoulq.abyssallib.world.gen.state.provider.BlockStateProvider
com.github.darksoulq.abyssallib.world.gen.state.provider.impl.WeightedBlockStateProvider
A block state provider that selects a block state from a pool based on relative weights.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single weighted option in the provider pool. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<WeightedBlockStateProvider> The codec used for serializing and deserializing the weighted provider.static final BlockStateProviderType<WeightedBlockStateProvider> The registered type definition for the weighted block state provider. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new WeightedBlockStateProvider. -
Method Summary
Modifier and TypeMethodDescriptionRandomly selects a block state from the pool based on relative weight.getType()Retrieves the specific type definition for this provider.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the weighted provider. -
TYPE
The registered type definition for the weighted block state provider.
-
-
Constructor Details
-
WeightedBlockStateProvider
Constructs a new WeightedBlockStateProvider.- Parameters:
entries- The list of weighted entries to select from.
-
-
Method Details
-
getState
Randomly selects a block state from the pool based on relative weight.- Specified by:
getStatein classBlockStateProvider- Parameters:
random- The random source.location- The placement location.- Returns:
- The selected block info, or null if the pool is empty.
-
getType
Retrieves the specific type definition for this provider.- Specified by:
getTypein classBlockStateProvider- Returns:
- The block state provider type.
-