Performance improvements for saveChanges() and ICellInventory (#3586)

API break!
Fixes #3553
This commit is contained in:
fscan
2018-07-14 16:53:49 +02:00
committed by GitHub
parent 71a9bb2532
commit e809c688df
37 changed files with 292 additions and 166 deletions
@@ -52,12 +52,12 @@ public interface ICellHandler
*
* @param is a storage cell item.
* @param host anytime the contents of your storage cell changes it should use this to request a save, please
* note, this value can be null.
* note, this value can be null. If provided, the host is responsible for persisting the cell content.
* @param channel the storage channel requested.
*
* @return a new IMEHandler for the provided item
*/
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
/**
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
@@ -118,4 +118,9 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
* @return the status number for this drive.
*/
int getStatusForCell();
/**
* Tells the cell to persist to NBT
*/
void persist();
}
@@ -34,7 +34,7 @@ public interface ICellInventoryHandler<T extends IAEStack<T>> extends IMEInvento
/**
* @return get access to the Cell Inventory.
*/
ICellInventory getCellInv();
ICellInventory<T> getCellInv();
boolean isPreformatted();
@@ -77,11 +77,11 @@ public interface ICellRegistry
* returns an IMEInventoryHandler for the provided item.
*
* @param is item with inventory handler
* @param host can be null, or the hosting tile / part.
* @param host can be null. If provided, the host is responsible for persisting the cell content.
* @param chan the storage channel to request the handler for.
*
* @return new IMEInventoryHandler, or null if there isn't one.
*/
@Nullable
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
}
@@ -24,8 +24,11 @@
package appeng.api.storage;
/**
* Tells the cell provider that changes have been made an the cell must be persisted
*
*/
public interface ISaveProvider
{
void saveChanges( IMEInventory<?> cellInventory );
void saveChanges( ICellInventory<?> cellInventory );
}