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
BiConsumers 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, Random> consumer) Adds a new biconsumer in the current order.default <V> ItemStackGenerator.BuilderAdds the givenKeywith the given value.Adds the givenKeywith the given value.addAll(Collection<BiConsumer<ItemStack.Builder, Random>> collection) Adds all the provided biconsumers from the provided collection.default ItemStackGenerator.BuilderSets the baseItemTypefor theItemStackGenerator.Sets the baseItemTypefor theItemStackGenerator.baseItem(WeightedTable<ItemType> itemType) Sets the baseItemTypefor theItemStackGenerator.build()Creates a newItemStackGeneratorwith all of the addedBiConsumers.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
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 baseItemTypefor theItemStackGenerator. A base type must be set to avoid issues.- Parameters:
itemType- The base item type- Returns:
- This builder, for chaining
-
baseItem
Sets the baseItemTypefor theItemStackGenerator. A base type must be set to avoid issues.- Parameters:
itemType- The base item type- Returns:
- This builder, for chaining
-
baseItem
Sets the baseItemTypefor theItemStackGenerator. Using the definedtableallows 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 givenKeywith 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 givenKeywith 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 newItemStackGeneratorwith all of the addedBiConsumers.- Specified by:
buildin interfaceAbstractBuilder<ItemStackGenerator>- Returns:
- The newly created itemstack generator
-