Interface ItemStack.Builder

    • Method Detail

      • itemType

        ItemStack.Builder itemType​(ItemType itemType)
        Sets the ItemType of the item stack.
        Parameters:
        itemType - The type of item
        Returns:
        This builder, for chaining
      • itemType

        default ItemStack.Builder itemType​(java.util.function.Supplier<? extends ItemType> itemType)
        Sets the ItemType of the item stack.
        Parameters:
        itemType - The type of item
        Returns:
        This builder, for chaining
      • quantity

        ItemStack.Builder quantity​(int quantity)
                            throws java.lang.IllegalArgumentException
        Sets the quantity of the item stack.
        Parameters:
        quantity - The quantity of the item stack
        Returns:
        This builder, for chaining
        Throws:
        java.lang.IllegalArgumentException - If the quantity is outside the allowed bounds
      • fromItemStack

        ItemStack.Builder fromItemStack​(ItemStack itemStack)
        Sets all the settings in this builder from the item stack blueprint.
        Parameters:
        itemStack - The item stack to copy
        Returns:
        This builder, for chaining
      • fromBlockState

        default ItemStack.Builder fromBlockState​(java.util.function.Supplier<? extends BlockState> blockState)
        Sets the data to recreate a BlockState in a held ItemStack state.
        Parameters:
        blockState - The block state to use
        Returns:
        This builder, for chaining
      • fromContainer

        ItemStack.Builder fromContainer​(DataView container)
        Attempts to reconstruct the builder with all of the data from DataSerializable.toContainer() including all custom data.
        Parameters:
        container - The container to translate
        Returns:
        This builder, for chaining
      • fromSnapshot

        default ItemStack.Builder fromSnapshot​(ItemStackSnapshot snapshot)
        Reconstructs this builder to use the ItemStackSnapshot for all the values and data it may contain.
        Parameters:
        snapshot - The snapshot
        Returns:
        This builder, for chaining
      • fromBlockSnapshot

        ItemStack.Builder fromBlockSnapshot​(BlockSnapshot blockSnapshot)
        Attempts to reconstruct a BlockSnapshot including all data and BlockEntity related data if necessary for creating an ItemStack representation.
        Parameters:
        blockSnapshot - The snapshot to use
        Returns:
        This builder, for chaining