Interface ItemStackGenerator.Builder
-
- All Superinterfaces:
AbstractBuilder<ItemStackGenerator>
,Buildable.Builder<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 variousBiConsumer
s that will be applied in order to anItemStackGenerator
. Normally, most all biconsumers can be created fromItemStackBuilderPopulators
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ItemStackGenerator.Builder
add(java.util.function.BiConsumer<ItemStack.Builder,java.util.Random> consumer)
Adds a new biconsumer in the current order.default <V> ItemStackGenerator.Builder
add(java.util.function.Supplier<? extends Key<? extends Value<V>>> key, V value)
Adds the givenKey
with the given value.<V> ItemStackGenerator.Builder
add(Key<? extends Value<V>> key, V value)
Adds the givenKey
with the given value.ItemStackGenerator.Builder
addAll(java.util.Collection<java.util.function.BiConsumer<ItemStack.Builder,java.util.Random>> collection)
Adds all the provided biconsumers from the provided collection.default ItemStackGenerator.Builder
baseItem(java.util.function.Supplier<? extends ItemType> itemType)
Sets the baseItemType
for theItemStackGenerator
.ItemStackGenerator.Builder
baseItem(ItemType itemType)
Sets the baseItemType
for theItemStackGenerator
.ItemStackGenerator.Builder
baseItem(WeightedTable<ItemType> itemType)
Sets the baseItemType
for theItemStackGenerator
.ItemStackGenerator
build()
Creates a newItemStackGenerator
with all of the addedBiConsumer
s.-
Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
-
-
-
Method Detail
-
add
ItemStackGenerator.Builder add(java.util.function.BiConsumer<ItemStack.Builder,java.util.Random> consumer)
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(java.util.Collection<java.util.function.BiConsumer<ItemStack.Builder,java.util.Random>> collection)
Adds all the provided biconsumers from the provided collection.- Parameters:
collection
- The collection of consumer to add- Returns:
- This builder, for chaining
-
baseItem
default ItemStackGenerator.Builder baseItem(java.util.function.Supplier<? extends ItemType> itemType)
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
ItemStackGenerator.Builder baseItem(ItemType itemType)
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
ItemStackGenerator.Builder baseItem(WeightedTable<ItemType> itemType)
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
<V> ItemStackGenerator.Builder add(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
-
add
default <V> ItemStackGenerator.Builder add(java.util.function.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>
- Specified by:
build
in interfaceBuildable.Builder<ItemStackGenerator>
- Returns:
- The newly created itemstack generator
-
-