public interface IStorageHelper
| Modifier and Type | Method and Description |
|---|---|
<T extends IAEStack<T>,C extends IStorageChannel<T>> |
getStorageChannel(java.lang.Class<C> channel)
Fetch the factory instance for a specific storage channel.
|
ICraftingLink |
loadCraftingLink(net.minecraft.nbt.NBTTagCompound data,
ICraftingRequester req)
load a crafting link from nbt data.
|
void |
postChanges(IStorageGrid gs,
net.minecraft.item.ItemStack removedCell,
net.minecraft.item.ItemStack addedCell,
IActionSource src)
Posts alteration of stored items to the provided
IStorageGrid. |
<T extends IAEStack<T>> |
poweredExtraction(IEnergySource energy,
IMEInventory<T> inv,
T request,
IActionSource src,
Actionable mode)
Extracts items from a
IMEInventory respecting power requirements. |
<T extends IAEStack<T>> |
poweredInsert(IEnergySource energy,
IMEInventory<T> inv,
T input,
IActionSource src,
Actionable mode)
Inserts items into a
IMEInventory respecting power requirements. |
<T extends IAEStack<T>,C extends IStorageChannel<T>> |
registerStorageChannel(java.lang.Class<C> channel,
C factory)
Register a new storage channel.
|
java.util.Collection<IStorageChannel<? extends IAEStack<?>>> |
storageChannels()
An unmodifiable collection of all registered factory instance.
|
@Nonnull <T extends IAEStack<T>,C extends IStorageChannel<T>> void registerStorageChannel(@Nonnull java.lang.Class<C> channel, @Nonnull C factory)
IAEItemStack and IAEFluidStack.
Each IAEStack subtype can only have a single factory instance. Overwriting is not intended.
Each subtype should be a direct one, this might be enforced at any time.
Channel class and factory instance can be used interchangeable as identifier. In most cases the factory instance
is used as key as having direct access the methods is more beneficial compared to being forced to query the
registry each time.
Caching the factory instance in a field or local variable is perfectly for performance reasons. But do not use
any AE2 internal field as they can change randomly between releases.channel - The channel type, must be a subtype of IStorageChannelfactory - An instance implementing the channel, must be be an instance of channel@Nonnull <T extends IAEStack<T>,C extends IStorageChannel<T>> C getStorageChannel(@Nonnull java.lang.Class<C> channel)
IStorageChannel.channel - The channel typejava.lang.NullPointerException - when fetching an unregistered channel.@Nonnull java.util.Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels()
ICraftingLink loadCraftingLink(net.minecraft.nbt.NBTTagCompound data, ICraftingRequester req)
data - to be loaded data<T extends IAEStack<T>> T poweredExtraction(IEnergySource energy, IMEInventory<T> inv, T request, IActionSource src, Actionable mode)
IMEInventory respecting power requirements.energy - Energy source.inv - Inventory to extract from.request - Requested item and count.src - Action source.mode - Simulate or modulatenull of nothing was extracted.<T extends IAEStack<T>> T poweredInsert(IEnergySource energy, IMEInventory<T> inv, T input, IActionSource src, Actionable mode)
IMEInventory respecting power requirements.energy - Energy source.inv - Inventory to insert into.request - Items to insert.src - Action source.mode - Simulate or modulatenull if everything was inserted.void postChanges(@Nonnull
IStorageGrid gs,
@Nonnull
net.minecraft.item.ItemStack removedCell,
@Nonnull
net.minecraft.item.ItemStack addedCell,
@Nonnull
IActionSource src)
IStorageGrid.
This can be used by cell containers to notify the grid of storage cell changes.gs - the storage grid.removedCell - the removed cell itemstackaddedCell - the added cell itemstacksrc - the action source