Interface MEStorage

All Known Subinterfaces:
StorageCell
All Known Implementing Classes:
SupplierStorage

public interface MEStorage
AE's Equivalent to IInventory, used to reading contents, and manipulating contents of ME Inventories.

Implementations should COMPLETELY ignore stack size limits from an external view point, Meaning that you can inject Integer.MAX_VALUE items and it should work as defined, or be able to extract Integer.MAX_VALUE and have it work as defined, Translations to MC's max stack size are external to the AE API.

If you want to request at most a stack of an item, you need to use ItemStack.getMaxStackSize() before extracting from this inventory.

As of 1.20, this is also directly used as a capability / API Lookup for storage busses and pattern providers to request access to another ME network so it can be used as a subnetwork. Can also be offered by addon mods if they want to control their MEStorage.

  • Method Details

    • isPreferredStorageFor

      default boolean isPreferredStorageFor(AEKey what, IActionSource source)
      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.

      Parameters:
      source - The source trying to find storage for stacks.
    • insert

      default long insert(AEKey what, long amount, Actionable mode, IActionSource source)
      Store new items, or simulate the addition of new items into the ME Inventory.
      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

      default long extract(AEKey what, long amount, Actionable mode, IActionSource source)
      Extract the specified item from the ME Inventory
      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

      default void getAvailableStacks(KeyCounter out)
      request a full report of all available items, storage.
      Parameters:
      out - The amounts for all available keys will be added to this tally.
    • getDescription

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

      default KeyCounter getAvailableStacks()
      request a full report of all available items, storage.
      Returns:
      a new list of this inventories content
    • checkPreconditions

      static void checkPreconditions(AEKey what, long amount, Actionable mode, IActionSource source)