Class ItemStackBuilderPopulators

    • Method Detail

      • quantity

        public static BiConsumer<ItemStack.Builder,​Random> quantity​(VariableAmount amount)
        Creates a new 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.

        Parameters:
        amount - The variable amount
        Returns:
        The new biconsumer to apply to an itemstack builder
      • quantity

        public static BiConsumer<ItemStack.Builder,​Random> quantity​(Supplier<VariableAmount> supplier)
        Creates a new 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.

        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 new 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 values(Iterable) or any variant thereof for applying custom data.

        Type Parameters:
        E - The type of value
        Parameters:
        key - The key to use
        value - 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 new 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 values(Iterable) or any variant thereof for applying custom data.

        Type Parameters:
        E - The type of value
        Parameters:
        key - The key to use
        values - 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 new BiConsumer where the Key is responsible for a List based Value.Mutable. 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 values(Iterable) or any variant thereof for applying custom data.

        Type Parameters:
        E - The type of elements
        Parameters:
        key - The key to use
        elementPool - The pool of possible values
        amount - 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 new BiConsumer where the Key is responsible for a List based Value.Mutable. 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 values(Iterable) or any variant thereof for applying custom data.

        Type Parameters:
        E - The type of elements
        Parameters:
        key - The key to use
        elementPool - 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 new BiConsumer where the Key is responsible for a List based Value.Mutable. 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 values(Iterable) or any variant thereof for applying custom data.

        Type Parameters:
        E - The type of elements
        Parameters:
        key - The key to use
        weightedTable - 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 new BiConsumer where the Key is responsible for a List based Value.Mutable. Given the WeightedTable is exclusively used with Functions, the Functions 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.Mutable.

        An example usage of this can be for generating a randomized list of Enchantments 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 use
        weightedTable - The weighted table containing all the desired functions producing the randomized elements
        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)
        Creates a new BiConsumer where the Key is responsible for a Set based Value.Mutable. 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 values(Iterable) or any variant thereof for applying custom data.

        Type Parameters:
        E - The type of element
        Parameters:
        key - The key to use
        elementPool - 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 new BiConsumer where the Key is responsible for a Set based Value.Mutable. 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.
        Type Parameters:
        E - The type of element
        Parameters:
        key - The key to use
        elementPool - The set of elements to use as a pool
        amount - The variable amount of elements to get
        Returns:
        The new biconsumer to apply to an itemstack builder
      • value

        public static <E,​V extends Value<E>> BiConsumer<ItemStack.Builder,​Random> value​(V value)
        Creates a new BiConsumer that applies the provided Value.Mutable to the generated ItemStack.
        Type Parameters:
        E - The type of element
        V - 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 new BiConsumer that applies a random selection of the provided Values.
        Type Parameters:
        E - The type of element
        V - 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​(WeightedTable<Value.Immutable<?>> weightedTable)
        Creates a new BiConsumer that provides a variable amount of Values from the provided WeightedTable. 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

        public static BiConsumer<ItemStack.Builder,​Random> enchantment​(EnchantmentType enchantmentType)
        Creates a new BiConsumer that takes the provided EnchantmentType and applies it to the generated ItemStack. 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 new BiConsumer that takes the provided EnchantmentType and applies it to the generated ItemStack. The enchantmentType level is defined by the variable amount provided.
        Parameters:
        level - The variance in enchantmentType level
        enchantmentType - The enchantmentType to add
        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 new BiConsumer that takes the provided EnchantmentTypes and applies a variable amount of enchantmentTypes with varying levels to the generated ItemStack.
        Parameters:
        amount - The variable amount of enchantmentTypes to use
        enchantmentType - The first enchantmentType to add
        enchantmentTypes - The additional enchantmentTypes to use
        Returns:
        The new biconsumer to apply to an itemstack builder