Interface ItemStackGenerator.Builder
- All Superinterfaces:
AbstractBuilder<ItemStackGenerator>
,Builder<ItemStackGenerator,
,ItemStackGenerator.Builder> CopyableBuilder<ItemStackGenerator,
,ItemStackGenerator.Builder> ResettableBuilder<ItemStackGenerator,
ItemStackGenerator.Builder>
- Enclosing interface:
ItemStackGenerator
public static interface ItemStackGenerator.Builder
extends Builder<ItemStackGenerator,ItemStackGenerator.Builder>, CopyableBuilder<ItemStackGenerator,ItemStackGenerator.Builder>
A builder to add various
BiConsumer
s that will be applied in order
to an ItemStackGenerator
. Normally, most all biconsumers can be
created from ItemStackBuilderPopulators
.-
Method Summary
Modifier and TypeMethodDescriptionadd
(BiConsumer<ItemStack.Builder, RandomGenerator> consumer) Adds a new biconsumer in the current order.default <V> ItemStackGenerator.Builder
Adds the givenKey
with the given value.Adds the givenKey
with the given value.addAll
(Collection<BiConsumer<ItemStack.Builder, RandomGenerator>> collection) Adds all the provided biconsumers from the provided collection.default ItemStackGenerator.Builder
Sets the baseItemType
for theItemStackGenerator
.Sets the baseItemType
for theItemStackGenerator
.baseItem
(WeightedTable<ItemType> itemType) Sets the baseItemType
for theItemStackGenerator
.build()
Creates a newItemStackGenerator
with all of the addedBiConsumer
s.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Method Details
-
add
Adds a new biconsumer in the current order.- Parameters:
consumer
- The consumer that mutates an itemstack builder- Returns:
- This builder, for chaining
-
addAll
ItemStackGenerator.Builder addAll(Collection<BiConsumer<ItemStack.Builder, RandomGenerator>> collection) Adds all the provided biconsumers from the provided collection.- Parameters:
collection
- The collection of consumer to add- Returns:
- This builder, for chaining
-
baseItem
Sets the baseItemType
for theItemStackGenerator
. A base type must be set to avoid issues.- Parameters:
itemType
- The base item type- Returns:
- This builder, for chaining
-
baseItem
Sets the baseItemType
for theItemStackGenerator
. A base type must be set to avoid issues.- Parameters:
itemType
- The base item type- Returns:
- This builder, for chaining
-
baseItem
Sets the baseItemType
for theItemStackGenerator
. Using the definedtable
allows for some dynamic selection of the returned type, instead of requiring anadd(BiConsumer)
for each individual variation of a desired type.- Parameters:
itemType
- The base item type- Returns:
- This builder, for chaining
-
add
Adds the givenKey
with the given value.- Type Parameters:
V
- The type of the value- Parameters:
key
- The key to assign the value withvalue
- The value to assign with the key- Returns:
- This builder, for chaining
-
add
default <V> ItemStackGenerator.Builder add(Supplier<? extends Key<? extends Value<V>>> key, V value) Adds the givenKey
with the given value.- Type Parameters:
V
- The type of the value- Parameters:
key
- The key to assign the value withvalue
- The value to assign with the key- Returns:
- This builder, for chaining
-
build
ItemStackGenerator build()Creates a newItemStackGenerator
with all of the addedBiConsumer
s.- Specified by:
build
in interfaceAbstractBuilder<ItemStackGenerator>
- Returns:
- The newly created itemstack generator
-