Interface StorageView<T>

Type Parameters:
T - The type of the stored resource.
All Known Subinterfaces:
SingleSlotStorage<T>
All Known Implementing Classes:
BlankVariantView, FullItemFluidStorage, SingleFluidStorage, SingleStackStorage, SingleVariantItemStorage, SingleVariantStorage

@Experimental @Deprecated public interface StorageView<T>
Deprecated.
Experimental feature, we reserve the right to remove or change it without further notice. The transfer API is a complex addition, and we want to be able to correct possible design mistakes.
A view of a single stored resource in a Storage, for use with Storage.iterator(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext) or Storage.exactView(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext, T).

A view is always tied to a specific transaction, and should not be accessed outside of it.

  • Method Summary

    Modifier and Type
    Method
    Description
    long
    extract​(T resource, long maxAmount, TransactionContext transaction)
    Deprecated.
    Try to extract a resource from this view.
    long
    Deprecated.
     
    long
    Deprecated.
     
    Deprecated.
     
    boolean
    Deprecated.
     
  • Method Details

    • extract

      long extract(T resource, long maxAmount, TransactionContext transaction)
      Deprecated.
      Try to extract a resource from this view.
      Returns:
      The amount that was extracted.
    • isResourceBlank

      boolean isResourceBlank()
      Deprecated.
      Returns:
      true if the getResource() contained in this storage view is blank, or false otherwise.
    • getResource

      T getResource()
      Deprecated.
      Returns:
      The resource stored in this view. May not be blank if isResourceBlank() is false.
    • getAmount

      long getAmount()
      Deprecated.
      Returns:
      The amount of getResource() stored in this view.
    • getCapacity

      long getCapacity()
      Deprecated.
      Returns:
      The total amount of getResource() that could be stored in this view, or an estimate of the number of resources that could be stored if this view has a blank resource.