Class SupplierStorage

java.lang.Object
appeng.api.storage.SupplierStorage
All Implemented Interfaces:
MEStorage

public final class SupplierStorage extends Object implements MEStorage
Delegates all calls to a MEStorage returned by a supplier such that the underlying storage can change dynamically. If the supplier returns a null value, this storage will appear empty and read-only.
  • Constructor Details

  • Method Details

    • isPreferredStorageFor

      public boolean isPreferredStorageFor(AEKey what, IActionSource source)
      Description copied from interface: MEStorage
      Returns whether this inventory is the preferred storage location for the given stack when being compared to other inventories of the same overall priority.

      If for example an inventory already contains some amount of an item, it should be preferred over other inventories that don't when trying to store more of the item.

      Specified by:
      isPreferredStorageFor in interface MEStorage
      Parameters:
      source - The source trying to find storage for stacks.
    • insert

      public long insert(AEKey what, long amount, Actionable mode, IActionSource source)
      Description copied from interface: MEStorage
      Store new items, or simulate the addition of new items into the ME Inventory.
      Specified by:
      insert in interface MEStorage
      Parameters:
      what - what to insert
      amount - how much of it to insert. must not be negative
      mode - action type
      Returns:
      returns the number of items inserted.
    • extract

      public long extract(AEKey what, long amount, Actionable mode, IActionSource source)
      Description copied from interface: MEStorage
      Extract the specified item from the ME Inventory
      Specified by:
      extract in interface MEStorage
      Parameters:
      what - what to extract
      amount - how much of it to extract (at most)
      mode - simulate, or perform action?
      Returns:
      returns the number of items extracted
    • getAvailableStacks

      public void getAvailableStacks(KeyCounter out)
      Description copied from interface: MEStorage
      request a full report of all available items, storage.
      Specified by:
      getAvailableStacks in interface MEStorage
      Parameters:
      out - The amounts for all available keys will be added to this tally.
    • getDescription

      public net.minecraft.network.chat.Component getDescription()
      Specified by:
      getDescription in interface MEStorage
      Returns:
      The type of storage represented by this object.
    • getAvailableStacks

      public KeyCounter getAvailableStacks()
      Description copied from interface: MEStorage
      request a full report of all available items, storage.
      Specified by:
      getAvailableStacks in interface MEStorage
      Returns:
      a new list of this inventories content