Class ItemStack.Builder

java.lang.Object
fr.fidorial.item.ItemStack.Builder
Enclosing class:
ItemStack

public static final class ItemStack.Builder extends Object
Builds a stack a component at a time.

The builder is mutable and is not safe to share between threads; the ItemStack it produces is.

Since:
0.1.0
  • Method Details

    • count

      public ItemStack.Builder count(int newCount)
      Parameters:
      newCount - how many
      Returns:
      this builder
    • edit

      Everything past the identifier and the count is described here, so there is one place to learn rather than three that drift apart.
      Parameters:
      editor - given the editor this builder is filling in
      Returns:
      this builder
      Since:
      0.1.0
    • set

      public <T> ItemStack.Builder set(DataComponentType<T> type, T value)
      Type Parameters:
      T - the component's value type
      Parameters:
      type - the component to set
      value - the value
      Returns:
      this builder
    • remove

      public ItemStack.Builder remove(DataComponentType<?> type)
      Parameters:
      type - the component whose default to remove
      Returns:
      this builder
    • reset

      public ItemStack.Builder reset(DataComponentType<?> type)
      Parameters:
      type - the component to stop patching
      Returns:
      this builder
      Since:
      0.1.0
    • build

      public ItemStack build()
      Returns:
      the built stack