Class ItemStackBuilderPopulators
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BiConsumer<ItemStack.Builder,
Random> enchantment
(EnchantmentType enchantmentType) Creates a newBiConsumer
that takes the providedEnchantmentType
and applies it to the generatedItemStack
.static BiConsumer<ItemStack.Builder,
Random> enchantment
(VariableAmount level, EnchantmentType enchantmentType) Creates a newBiConsumer
that takes the providedEnchantmentType
and applies it to the generatedItemStack
.static BiConsumer<ItemStack.Builder,
Random> enchantments
(VariableAmount amount, Collection<Tuple<EnchantmentType, VariableAmount>> enchantments) Creates a newBiConsumer
that takes the providedCollection
of coupledEnchantmentType
andVariableAmount
to apply varying enchantments of varying amounts to the generatedItemStack
.static BiConsumer<ItemStack.Builder,
Random> enchantmentsWithVanillaLevelVariance
(Collection<EnchantmentType> enchantmentTypes) Creates a newBiConsumer
that takes the providedCollection
ofEnchantmentType
s and applies a singularEnchantmentType
with varying levels to the generatedItemStack
.static BiConsumer<ItemStack.Builder,
Random> enchantmentsWithVanillaLevelVariance
(VariableAmount amount, Collection<EnchantmentType> itemEnchantmentTypes) Creates a newBiConsumer
that takes the providedCollection
ofEnchantmentType
s and applies a varying amount of generated enchantments to the generatedItemStack
.static BiConsumer<ItemStack.Builder,
Random> enchantmentsWithVanillaLevelVariance
(VariableAmount amount, EnchantmentType enchantmentType, EnchantmentType... enchantmentTypes) Creates a newBiConsumer
that takes the providedEnchantmentType
s and applies a variable amount of enchantmentTypes with varying levels to the generatedItemStack
.static BiConsumer<ItemStack.Builder,
Random> Creates a newBiConsumer
that defines the providedItemType
, provided that theSupplier
does not return null.static BiConsumer<ItemStack.Builder,
Random> Creates a newBiConsumer
that defines the providedItemType
.static BiConsumer<ItemStack.Builder,
Random> items
(Collection<ItemType> itemTypes) Creates a newBiConsumer
that provides a randomItemType
from the provided collection of item types.static BiConsumer<ItemStack.Builder,
Random> Creates a newBiConsumer
that provides a randomItemType
of the provided item types.static BiConsumer<ItemStack.Builder,
Random> itemStack
(ItemStackSnapshot snapshot) Creates a newBiConsumer
to set theItemStack.Builder
to use the providedItemStackSnapshot
as a "default".static BiConsumer<ItemStack.Builder,
Random> itemStacks
(ItemStackSnapshot snapshot, ItemStackSnapshot... snapshots) Creates a newBiConsumer
that uses a randomized selection of the providedItemStackSnapshot
s.static <E> BiConsumer<ItemStack.Builder,
Random> Creates a newBiConsumer
that sets the providedKey
'ed object where the value is possibly ignored or not supported.static <E> BiConsumer<ItemStack.Builder,
Random> Creates a newBiConsumer
that sets a single provided value with the providedKey
.static <E> BiConsumer<ItemStack.Builder,
Random> listValues
(Key<? extends ListValue.Mutable<E>> key, List<E> elementPool) static <E> BiConsumer<ItemStack.Builder,
Random> listValues
(Key<? extends ListValue.Mutable<E>> key, List<E> elementPool, VariableAmount amount) static <E> BiConsumer<ItemStack.Builder,
Random> listValues
(Key<? extends ListValue.Mutable<E>> key, WeightedTable<E> weightedTable) static <E> BiConsumer<ItemStack.Builder,
Random> listValueSuppliers
(Supplier<? extends Key<? extends ListValue<E>>> key, WeightedTable<Function<Random, 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 newBiConsumer
that sets the desired quantity for creating anItemStack
.static BiConsumer<ItemStack.Builder,
Random> quantity
(VariableAmount amount) Creates a newBiConsumer
that sets the desired quantity for creating anItemStack
.static <E> BiConsumer<ItemStack.Builder,
Random> setValues
(Key<? extends SetValue.Mutable<E>> key, Set<E> elementPool) static <E> BiConsumer<ItemStack.Builder,
Random> setValues
(Key<? extends SetValue.Mutable<E>> key, Set<E> elementPool, VariableAmount amount) static <E> BiConsumer<ItemStack.Builder,
Random> setValues
(Key<? extends SetValue.Mutable<E>> key, WeightedTable<E> weightedTable) static <E,
V extends Value<E>>
BiConsumer<ItemStack.Builder,Random> value
(V value) static <E,
V extends Value<E>>
BiConsumer<ItemStack.Builder,Random> Creates a newBiConsumer
that applies a random selection of the providedValue
s.static BiConsumer<ItemStack.Builder,
Random> values
(Collection<Value.Immutable<?>> manipulators, VariableAmount rolls) static BiConsumer<ItemStack.Builder,
Random> values
(WeightedTable<Value.Immutable<?>> weightedTable)
-
Method Details
-
itemStack
Creates a newBiConsumer
to set theItemStack.Builder
to use the providedItemStackSnapshot
as a "default". Note that the normal behavior of the builder is to reset according to the snapshot.- Parameters:
snapshot
- The snapshot to set the builder to use- Returns:
- The new biconsumer to apply to an itemstack builder
-
itemStacks
public static BiConsumer<ItemStack.Builder,Random> itemStacks(ItemStackSnapshot snapshot, ItemStackSnapshot... snapshots) Creates a newBiConsumer
that uses a randomized selection of the providedItemStackSnapshot
s. The builder, when called will only use one at random selection to default to.- Parameters:
snapshot
- The first snapshotsnapshots
- The additional snapshots- Returns:
- The new biconsumer to apply to an itemstack builder
-
item
Creates a newBiConsumer
that defines the providedItemType
.- Parameters:
itemType
- The given item type- Returns:
- The new biconsumer to apply to an itemstack builder
-
item
Creates a newBiConsumer
that defines the providedItemType
, provided that theSupplier
does not return null.Note that the
Supplier
is not queried for anItemType
until the generatedBiConsumer
is called.- Parameters:
supplier
- The supplier of the item type- Returns:
- The new biconsumer to apply to an itemstack builder
-
items
Creates a newBiConsumer
that provides a randomItemType
of the provided item types.Note that the desired
ItemType
given to the builder is only defined at the time of callingBiConsumer.accept(Object, Object)
.- Parameters:
itemType
- The first item typeitemTypes
- The additional item types- Returns:
- The new biconsumer to apply to an item stack builder
-
items
Creates a newBiConsumer
that provides a randomItemType
from the provided collection of item types.- Parameters:
itemTypes
- The item types to use- Returns:
- The new biconsumer to apply to an itemstack builder
-
quantity
Creates a newBiConsumer
that sets the desired quantity for creating anItemStack
.Note that the default behavior of the item stack builder is still expected to take place. Negative values are not allowed.
- Parameters:
amount
- The variable amount- Returns:
- The new biconsumer to apply to an itemstack builder
-
quantity
Creates a newBiConsumer
that sets the desired quantity for creating anItemStack
. The supplier is not queried for aVariableAmount
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.
- Parameters:
supplier
- The supplier of the variable amount- Returns:
- The new biconsumer to apply to an itemstack builder
-
keyValue
public static <E> BiConsumer<ItemStack.Builder,Random> keyValue(Key<? extends Value<E>> key, E value) Creates a newBiConsumer
that sets the providedKey
'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
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of value- Parameters:
key
- The key to usevalue
- The value to use- Returns:
- The new biconsumer to apply to an itemstack builder
-
keyValues
public static <E> BiConsumer<ItemStack.Builder,Random> keyValues(Key<? extends Value<E>> key, Iterable<E> values) Creates a newBiConsumer
that sets a single provided value with the providedKey
. Only a single value is chosen to provide to the itemstack builder.Note that custom data is not supported through this method, use
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of value- Parameters:
key
- The key to usevalues
- The pool of possible values- Returns:
- The new biconsumer to apply to an itemstack builder
-
listValues
public static <E> BiConsumer<ItemStack.Builder,Random> listValues(Key<? extends ListValue.Mutable<E>> key, List<E> elementPool, VariableAmount amount) Creates a newBiConsumer
where theKey
is responsible for aList
basedValue.Mutable
. Given that the provided elements are chosen with aRandom
, 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
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of elements- Parameters:
key
- The key to useelementPool
- The pool of possible valuesamount
- The variable amount of elements to add- Returns:
- The new biconsumer to apply to an itemstack builder
-
listValues
public static <E> BiConsumer<ItemStack.Builder,Random> listValues(Key<? extends ListValue.Mutable<E>> key, List<E> elementPool) Creates a newBiConsumer
where theKey
is responsible for aList
basedValue.Mutable
. Given that the provided elements are chosen with aRandom
, it's not clear that the elements will be added in bundles or in the same iteration order. The default variance is provided asVariableAmount.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
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of elements- Parameters:
key
- The key to useelementPool
- The pool of possible values- Returns:
- The new biconsumer to apply to an itemstack builder
-
listValues
public static <E> BiConsumer<ItemStack.Builder,Random> listValues(Key<? extends ListValue.Mutable<E>> key, WeightedTable<E> weightedTable) Creates a newBiConsumer
where theKey
is responsible for aList
basedValue.Mutable
. Given theWeightedTable
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
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of elements- Parameters:
key
- The key to useweightedTable
- The weighted table- Returns:
- The new biconsumer to apply to an itemstack builder
-
listValueSuppliers
public static <E> BiConsumer<ItemStack.Builder,Random> listValueSuppliers(Key<? extends ListValue<E>> key, WeightedTable<Function<Random, E>> weightedTable) Creates a newBiConsumer
where theKey
is responsible for aList
basedValue.Mutable
. Given theWeightedTable
is exclusively used withFunction
s, theFunction
s themselves are queried with aRandom
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'edListValue.Mutable
.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
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of element- Parameters:
key
- The key to useweightedTable
- The weighted table containing all the desired functions producing the randomized elements- Returns:
- The new biconsumer to apply to an itemstack builder
-
listValueSuppliers
public static <E> BiConsumer<ItemStack.Builder,Random> listValueSuppliers(Supplier<? extends Key<? extends ListValue<E>>> key, WeightedTable<Function<Random, E>> weightedTable) -
setValues
public static <E> BiConsumer<ItemStack.Builder,Random> setValues(Key<? extends SetValue.Mutable<E>> key, Set<E> elementPool) Creates a newBiConsumer
where theKey
is responsible for aSet
basedValue.Mutable
. Given theSet
of element to act as a pool, the consumer will pull a random amount of the given pool and apply it as a newSet
.Note that custom data is not supported through this method, use
values(Iterable)
or any variant thereof for applying custom data.- Type Parameters:
E
- The type of element- Parameters:
key
- The key to useelementPool
- The set of elements to use as a pool- Returns:
- The new biconsumer to apply to an itemstack builder
-
setValues
public static <E> BiConsumer<ItemStack.Builder,Random> setValues(Key<? extends SetValue.Mutable<E>> key, Set<E> elementPool, VariableAmount amount) Creates a newBiConsumer
where theKey
is responsible for aSet
basedValue.Mutable
. Given theSet
of elements to act as a pool, the consumer will pull a variable amount based on the providedVariableAmount
, and apply it as a newSet
.- Type Parameters:
E
- The type of element- Parameters:
key
- The key to useelementPool
- The set of elements to use as a poolamount
- The variable amount of elements to get- Returns:
- The new biconsumer to apply to an itemstack builder
-
setValues
public static <E> BiConsumer<ItemStack.Builder,Random> setValues(Key<? extends SetValue.Mutable<E>> key, WeightedTable<E> weightedTable) Creates a newBiConsumer
where theKey
is responsible for aSet
basedValue.Mutable
. Given the providedWeightedTable
, the consumer will retrieve aList
of values and add them as a newSet
.- Type Parameters:
E
- The type of element- Parameters:
key
- The key to useweightedTable
- The weighted table acting as an element pool- Returns:
- The new biconsumer to apply to an itemstack builder
-
value
- Type Parameters:
E
- The type of elementV
- The type of value- Parameters:
value
- The value to use- Returns:
- The new biconsumer to apply to an itemstack builder
-
values
public static <E,V extends Value<E>> BiConsumer<ItemStack.Builder,Random> values(Iterable<V> values) Creates a newBiConsumer
that applies a random selection of the providedValue
s.- Type Parameters:
E
- The type of elementV
- The type of value- Parameters:
values
- The iterable collection of values to choose from- Returns:
- The new biconsumer to apply to an itemstack builder
-
values
public static BiConsumer<ItemStack.Builder,Random> values(Collection<Value.Immutable<?>> manipulators, VariableAmount rolls) Creates a newBiConsumer
that provides aVariableAmount
ofValue
s from the provided pool. Note that no validation can be performed, however the builder will ignore unsupported data.- Parameters:
manipulators
- The manipulator pool to userolls
- The variable amount of manipulators to apply- Returns:
- The new biconsumer to apply to an itemstack builder
-
values
public static BiConsumer<ItemStack.Builder,Random> values(WeightedTable<Value.Immutable<?>> weightedTable) Creates a newBiConsumer
that provides a variable amount ofValue
s from the providedWeightedTable
. Note that no validation can be performed, however the builder will ignore unsupported data.- Parameters:
weightedTable
- The weighted table containing manipulators- Returns:
- The new biconsumer to apply to an itemstack builder
-
enchantment
Creates a newBiConsumer
that takes the providedEnchantmentType
and applies it to the generatedItemStack
. The enchantmentType level is varied based on vanilla mechanics.- Parameters:
enchantmentType
- The singular enchantmentType to add- Returns:
- The new biconsumer to apply to an itemstack builder
-
enchantment
public static BiConsumer<ItemStack.Builder,Random> enchantment(VariableAmount level, EnchantmentType enchantmentType) Creates a newBiConsumer
that takes the providedEnchantmentType
and applies it to the generatedItemStack
. The enchantmentType level is defined by the variable amount provided.- Parameters:
level
- The variance in enchantmentType levelenchantmentType
- The enchantmentType to add- Returns:
- The new biconsumer to apply to an itemstack builder
-
enchantmentsWithVanillaLevelVariance
public static BiConsumer<ItemStack.Builder,Random> enchantmentsWithVanillaLevelVariance(Collection<EnchantmentType> enchantmentTypes) Creates a newBiConsumer
that takes the providedCollection
ofEnchantmentType
s and applies a singularEnchantmentType
with varying levels to the generatedItemStack
.- Parameters:
enchantmentTypes
- The enchantment pool to choose from- Returns:
- The new biconsumer to apply to an itemstack builder
-
enchantmentsWithVanillaLevelVariance
public static BiConsumer<ItemStack.Builder,Random> enchantmentsWithVanillaLevelVariance(VariableAmount amount, EnchantmentType enchantmentType, EnchantmentType... enchantmentTypes) Creates a newBiConsumer
that takes the providedEnchantmentType
s and applies a variable amount of enchantmentTypes with varying levels to the generatedItemStack
.- Parameters:
amount
- The variable amount of enchantmentTypes to useenchantmentType
- The first enchantmentType to addenchantmentTypes
- The additional enchantmentTypes to use- Returns:
- The new biconsumer to apply to an itemstack builder
-
enchantmentsWithVanillaLevelVariance
public static BiConsumer<ItemStack.Builder,Random> enchantmentsWithVanillaLevelVariance(VariableAmount amount, Collection<EnchantmentType> itemEnchantmentTypes) Creates a newBiConsumer
that takes the providedCollection
ofEnchantmentType
s and applies a varying amount of generated enchantments to the generatedItemStack
.- Parameters:
amount
- The varying amount of enchantments to useitemEnchantmentTypes
- The enchantment pool to use- Returns:
- The new biconsumer to apply to an itemstack builder
-
enchantments
public static BiConsumer<ItemStack.Builder,Random> enchantments(VariableAmount amount, Collection<Tuple<EnchantmentType, VariableAmount>> enchantments) Creates a newBiConsumer
that takes the providedCollection
of coupledEnchantmentType
andVariableAmount
to apply varying enchantments of varying amounts to the generatedItemStack
.- Parameters:
amount
- The varying amount of enchantmentsenchantments
- The collection of enchantment tuples combining the enchantment and the variable amount of level to apply- Returns:
- The new biconsumer to apply to an itemstack builder
-