public final class ItemStackBuilderPopulators extends Object
BiConsumer
s to apply to an
ItemStack.Builder
, usually through an ItemStackGenerator
.
Note that the BiConsumer
s are expected to utilize the passed in
Random
and use the builder as necessary.
Modifier and Type | Method and Description |
---|---|
static BiConsumer<ItemStack.Builder,Random> |
data(Collection<DataManipulator<?,?>> manipulators)
Creates a new
BiConsumer that sets a single
DataManipulator form the provided collection of manipulators. |
static BiConsumer<ItemStack.Builder,Random> |
data(Collection<DataManipulator<?,?>> manipulators,
VariableAmount rolls)
|
static BiConsumer<ItemStack.Builder,Random> |
data(DataManipulator<?,?> manipulator)
|
static BiConsumer<ItemStack.Builder,Random> |
data(WeightedTable<DataManipulator<?,?>> weightedTable)
Creates a new
BiConsumer that provides a variable
amount of DataManipulator s from the provided
WeightedTable . |
static BiConsumer<ItemStack.Builder,Random> |
enchantment(EnchantmentType enchantmentType)
Creates a new
BiConsumer that takes the provided
EnchantmentType and applies it to the generated ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
enchantment(VariableAmount level,
EnchantmentType enchantmentType)
Creates a new
BiConsumer that takes the provided
EnchantmentType and applies it to the generated ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
enchantments(VariableAmount amount,
Collection<Tuple<EnchantmentType,VariableAmount>> enchantments)
Creates a new
BiConsumer that takes the provided
Collection of coupled EnchantmentType and
VariableAmount to apply varying enchantments of varying amounts
to the generated ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
enchantmentsWithVanillaLevelVariance(Collection<EnchantmentType> enchantmentTypes)
Creates a new
BiConsumer that takes the provided
Collection of EnchantmentType s and applies a
singular EnchantmentType with varying levels to the generated
ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
enchantmentsWithVanillaLevelVariance(VariableAmount amount,
Collection<EnchantmentType> itemEnchantmentTypes)
Creates a new
BiConsumer that takes the provided
Collection of EnchantmentType s and applies a varying amount
of generated enchantments to the generated ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
enchantmentsWithVanillaLevelVariance(VariableAmount amount,
EnchantmentType enchantmentType,
EnchantmentType... enchantmentTypes)
Creates a new
BiConsumer that takes the provided
EnchantmentType s and applies a variable amount of enchantmentTypes
with varying levels to the generated ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
item(ItemType itemType)
Creates a new
BiConsumer that defines the provided
ItemType . |
static BiConsumer<ItemStack.Builder,Random> |
item(Supplier<ItemType> supplier)
Creates a new
BiConsumer that defines the provided
ItemType , provided that the Supplier does not
return null. |
static BiConsumer<ItemStack.Builder,Random> |
items(Collection<ItemType> itemTypes)
Creates a new
BiConsumer that provides a random
ItemType from the provided collection of item types. |
static BiConsumer<ItemStack.Builder,Random> |
items(ItemType itemType,
ItemType... itemTypes)
Creates a new
BiConsumer that provides a random
ItemType of the provided item types. |
static BiConsumer<ItemStack.Builder,Random> |
itemStack(ItemStackSnapshot snapshot)
Creates a new
BiConsumer to set the ItemStack.Builder
to use the provided ItemStackSnapshot as a "default". |
static BiConsumer<ItemStack.Builder,Random> |
itemStacks(ItemStackSnapshot snapshot,
ItemStackSnapshot... snapshots)
Creates a new
BiConsumer that uses a randomized selection
of the provided ItemStackSnapshot s. |
static <E> BiConsumer<ItemStack.Builder,Random> |
keyValue(Key<? extends BaseValue<E>> key,
E value)
Creates a new
BiConsumer that sets the provided Key 'ed
object where the value is possibly ignored or not supported. |
static <E> BiConsumer<ItemStack.Builder,Random> |
keyValues(Key<? extends BaseValue<E>> key,
Iterable<E> values)
Creates a new
BiConsumer that sets a single provided
value with the provided Key . |
static <E> BiConsumer<ItemStack.Builder,Random> |
listValues(Key<? extends ListValue<E>> key,
List<E> elementPool)
|
static <E> BiConsumer<ItemStack.Builder,Random> |
listValues(Key<? extends ListValue<E>> key,
List<E> elementPool,
VariableAmount amount)
|
static <E> BiConsumer<ItemStack.Builder,Random> |
listValues(Key<? extends ListValue<E>> key,
WeightedTable<E> weightedTable)
|
static <E> BiConsumer<ItemStack.Builder,Random> |
listValueSuppliers(Key<? extends ListValue<E>> key,
WeightedTable<Function<Random,E>> weightedTable)
|
static BiConsumer<ItemStack.Builder,Random> |
quantity(Supplier<VariableAmount> supplier)
Creates a new
BiConsumer that sets the desired quantity
for creating an ItemStack . |
static BiConsumer<ItemStack.Builder,Random> |
quantity(VariableAmount amount)
Creates a new
BiConsumer that sets the desired quantity
for creating an ItemStack . |
static <E> BiConsumer<ItemStack.Builder,Random> |
setValues(Key<? extends SetValue<E>> key,
Set<E> elementPool)
|
static <E> BiConsumer<ItemStack.Builder,Random> |
setValues(Key<? extends SetValue<E>> key,
Set<E> elementPool,
VariableAmount amount)
|
static <E> BiConsumer<ItemStack.Builder,Random> |
setValues(Key<? extends SetValue<E>> key,
WeightedTable<E> weightedTable)
|
static <E,V extends BaseValue<E>> |
value(V value)
|
static <E,V extends BaseValue<E>> |
values(Iterable<V> values)
Creates a new
BiConsumer that applies a random selection of the
provided BaseValue s. |
public static BiConsumer<ItemStack.Builder,Random> itemStack(ItemStackSnapshot snapshot)
BiConsumer
to set the ItemStack.Builder
to use the provided ItemStackSnapshot
as a "default". Note
that the normal behavior of the builder is to reset according to
the snapshot.snapshot
- The snapshot to set the builder to usepublic static BiConsumer<ItemStack.Builder,Random> itemStacks(ItemStackSnapshot snapshot, ItemStackSnapshot... snapshots)
BiConsumer
that uses a randomized selection
of the provided ItemStackSnapshot
s. The builder, when called will
only use one at random selection to default to.snapshot
- The first snapshotsnapshots
- The additional snapshotspublic static BiConsumer<ItemStack.Builder,Random> item(ItemType itemType)
BiConsumer
that defines the provided
ItemType
.itemType
- The given item typepublic static BiConsumer<ItemStack.Builder,Random> item(Supplier<ItemType> supplier)
BiConsumer
that defines the provided
ItemType
, provided that the Supplier
does not
return null.
Note that the Supplier
is not queried for an
ItemType
until the generated BiConsumer
is
called.
supplier
- The supplier of the item typepublic static BiConsumer<ItemStack.Builder,Random> items(ItemType itemType, ItemType... itemTypes)
BiConsumer
that provides a random
ItemType
of the provided item types.
Note that the desired ItemType
given to the builder is only
defined at the time of calling BiConsumer.accept(Object, Object)
.
itemType
- The first item typeitemTypes
- The additional item typespublic static BiConsumer<ItemStack.Builder,Random> items(Collection<ItemType> itemTypes)
BiConsumer
that provides a random
ItemType
from the provided collection of item types.itemTypes
- The item types to usepublic static BiConsumer<ItemStack.Builder,Random> quantity(VariableAmount amount)
BiConsumer
that sets the desired quantity
for creating an ItemStack
.
Note that the default behavior of the item stack builder is still expected to take place. Negative values are not allowed.
amount
- The variable amountpublic static BiConsumer<ItemStack.Builder,Random> quantity(Supplier<VariableAmount> supplier)
BiConsumer
that sets the desired quantity
for creating an ItemStack
. The supplier is not queried for
a VariableAmount
until the generated bi consumer is
called on.
Note that the default behavior of an item stack builder is still expected to take place. Negative values are not allowed.
supplier
- The supplier of the variable amountpublic static <E> BiConsumer<ItemStack.Builder,Random> keyValue(Key<? extends BaseValue<E>> key, E value)
BiConsumer
that sets the provided Key
'ed
object where the value is possibly ignored or not supported. No checks
on whether the key or object is supported until called upon.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of valuekey
- The key to usevalue
- The value to usepublic static <E> BiConsumer<ItemStack.Builder,Random> keyValues(Key<? extends BaseValue<E>> key, Iterable<E> values)
BiConsumer
that sets a single provided
value with the provided Key
. Only a single value is chosen
to provide to the itemstack builder.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of valuekey
- The key to usevalues
- The pool of possible valuespublic static <E> BiConsumer<ItemStack.Builder,Random> listValues(Key<? extends ListValue<E>> key, List<E> elementPool, VariableAmount amount)
BiConsumer
where the Key
is responsible
for a List
based Value
. Given that the provided elements
are chosen with a Random
, it's not clear that the elements will
be added in bundles or in the same iteration order.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementskey
- The key to useelementPool
- The pool of possible valuesamount
- The variable amount of elements to addpublic static <E> BiConsumer<ItemStack.Builder,Random> listValues(Key<? extends ListValue<E>> key, List<E> elementPool)
BiConsumer
where the Key
is responsible
for a List
based Value
. Given that the provided elements
are chosen with a Random
, it's not clear that the elements will
be added in bundles or in the same iteration order. The default variance
is provided as VariableAmount.baseWithRandomAddition(double, double)
where at the least, a single element is chosen, and at most the entire
collection is chosen.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementskey
- The key to useelementPool
- The pool of possible valuespublic static <E> BiConsumer<ItemStack.Builder,Random> listValues(Key<? extends ListValue<E>> key, WeightedTable<E> weightedTable)
BiConsumer
where the Key
is responsible
for a List
based Value
. Given the WeightedTable
is already generated, the values requested are only retrieved when
the generated biconsumer is called upon.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementskey
- The key to useweightedTable
- The weighted tablepublic static <E> BiConsumer<ItemStack.Builder,Random> listValueSuppliers(Key<? extends ListValue<E>> key, WeightedTable<Function<Random,E>> weightedTable)
BiConsumer
where the Key
is responsible
for a List
based Value
. Given the
WeightedTable
is exclusively used with Function
s,
the Function
s themselves are queried with a Random
and expected to present a singular element of the defined type. It's
expected that there are multiple functions to provide additional
elements for a particular key'ed ListValue
.
An example usage of this can be for generating a randomized list
of Enchantment
s with varying enchantment levels.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementkey
- The key to useweightedTable
- The weighted table containing all the desired
functions producing the randomized elementspublic static <E> BiConsumer<ItemStack.Builder,Random> setValues(Key<? extends SetValue<E>> key, Set<E> elementPool)
BiConsumer
where the Key
is responsible
for a Set
based Value
. Given the Set
of element
to act as a pool, the consumer will pull a random amount of the
given pool and apply it as a new Set
.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementkey
- The key to useelementPool
- The set of elements to use as a poolpublic static <E> BiConsumer<ItemStack.Builder,Random> setValues(Key<? extends SetValue<E>> key, Set<E> elementPool, VariableAmount amount)
BiConsumer
where the Key
is responsible
for a Set
based Value
. Given the Set
of
elements to act as a pool, the consumer will pull a variable amount
based on the provided VariableAmount
, and apply it as a new
Set
.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementkey
- The key to useelementPool
- The set of elements to use as a poolamount
- The variable amount of elements to getpublic static <E> BiConsumer<ItemStack.Builder,Random> setValues(Key<? extends SetValue<E>> key, WeightedTable<E> weightedTable)
BiConsumer
where the Key
is
responsible for a Set
based Value
. Given
the provided WeightedTable
, the consumer will retrieve
a List
of values and add them as a new Set
.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementkey
- The key to useweightedTable
- The weighted table acting as an element poolpublic static <E,V extends BaseValue<E>> BiConsumer<ItemStack.Builder,Random> value(V value)
BiConsumer
that applies the provided Value
to the generated ItemStack
.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementV
- The type of valuevalue
- The value to usepublic static <E,V extends BaseValue<E>> BiConsumer<ItemStack.Builder,Random> values(Iterable<V> values)
BiConsumer
that applies a random selection of the
provided BaseValue
s.
Note that custom data is not supported through this method, use
data(Collection)
or any variant thereof for applying custom data.
E
- The type of elementV
- The type of valuevalues
- The iterable collection of values to choose frompublic static BiConsumer<ItemStack.Builder,Random> data(DataManipulator<?,?> manipulator)
BiConsumer
that sets a particular
DataManipulator
onto an ItemStack
. Note
that no validation can be performed, however the builder
will ignore unsupported data. This can be used to provide
custom data manipulators.manipulator
- The manipulator to apply to an itemstackpublic static BiConsumer<ItemStack.Builder,Random> data(Collection<DataManipulator<?,?>> manipulators)
BiConsumer
that sets a single
DataManipulator
form the provided collection of manipulators.
Note that no validation can be performed, however the builder will
ignore unsupported data. This can be used to provide custom data
manipulators. To apply multiple manipulators, use
data(Collection, VariableAmount)
.manipulators
- The pool of manipulators to usepublic static BiConsumer<ItemStack.Builder,Random> data(Collection<DataManipulator<?,?>> manipulators, VariableAmount rolls)
BiConsumer
that provides a VariableAmount
of DataManipulator
s from the provided pool. Note that no
validation can be performed, however the builder will ignore unsupported
data. This can be used to provide custom data manipulators.manipulators
- The manipulator pool to userolls
- The variable amount of manipulators to applypublic static BiConsumer<ItemStack.Builder,Random> data(WeightedTable<DataManipulator<?,?>> weightedTable)
BiConsumer
that provides a variable
amount of DataManipulator
s from the provided
WeightedTable
. Note that no validation can be performed, however
the builder will ignore unsupported data. This can be used to provide
custom data manipulators.weightedTable
- The weighted table containing manipulatorspublic static BiConsumer<ItemStack.Builder,Random> enchantment(EnchantmentType enchantmentType)
BiConsumer
that takes the provided
EnchantmentType
and applies it to the generated ItemStack
.
The enchantmentType level is varied based on vanilla mechanics.enchantmentType
- The singular enchantmentType to addpublic static BiConsumer<ItemStack.Builder,Random> enchantment(VariableAmount level, EnchantmentType enchantmentType)
BiConsumer
that takes the provided
EnchantmentType
and applies it to the generated ItemStack
.
The enchantmentType level is defined by the variable amount provided.level
- The variance in enchantmentType levelenchantmentType
- The enchantmentType to addpublic static BiConsumer<ItemStack.Builder,Random> enchantmentsWithVanillaLevelVariance(Collection<EnchantmentType> enchantmentTypes)
BiConsumer
that takes the provided
Collection
of EnchantmentType
s and applies a
singular EnchantmentType
with varying levels to the generated
ItemStack
.enchantmentTypes
- The enchantment pool to choose frompublic static BiConsumer<ItemStack.Builder,Random> enchantmentsWithVanillaLevelVariance(VariableAmount amount, EnchantmentType enchantmentType, EnchantmentType... enchantmentTypes)
BiConsumer
that takes the provided
EnchantmentType
s and applies a variable amount of enchantmentTypes
with varying levels to the generated ItemStack
.amount
- The variable amount of enchantmentTypes to useenchantmentType
- The first enchantmentType to addenchantmentTypes
- The additional enchantmentTypes to usepublic static BiConsumer<ItemStack.Builder,Random> enchantmentsWithVanillaLevelVariance(VariableAmount amount, Collection<EnchantmentType> itemEnchantmentTypes)
BiConsumer
that takes the provided
Collection
of EnchantmentType
s and applies a varying amount
of generated enchantments to the generated ItemStack
.amount
- The varying amount of enchantments to useitemEnchantmentTypes
- The enchantment pool to usepublic static BiConsumer<ItemStack.Builder,Random> enchantments(VariableAmount amount, Collection<Tuple<EnchantmentType,VariableAmount>> enchantments)
BiConsumer
that takes the provided
Collection
of coupled EnchantmentType
and
VariableAmount
to apply varying enchantments of varying amounts
to the generated ItemStack
.amount
- The varying amount of enchantmentsenchantments
- The collection of enchantment tuples combining the
enchantment and the variable amount of level to apply