Compare commits
1 Commits
v0.56.1
...
wip-is-cache
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fc96295a8 |
+1
-1
@@ -4,7 +4,7 @@ aebuild=7
|
||||
aegroup=appeng
|
||||
aebasename=appliedenergistics2
|
||||
trousers=trousers_edition
|
||||
trousersversion=v49s
|
||||
trousersversion=v49t
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
|
||||
@@ -121,4 +121,8 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
||||
*/
|
||||
boolean equals(ItemStack is);
|
||||
|
||||
ItemStack getCachedItemStack();
|
||||
|
||||
void setCachedItemStack(ItemStack is);
|
||||
|
||||
}
|
||||
@@ -62,8 +62,6 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
private StorageFilter mode;
|
||||
private AccessRestriction access;
|
||||
|
||||
private ItemStack stackCache = null;
|
||||
|
||||
ItemHandlerAdapter( IItemHandler itemHandler, IGridProxyable proxy )
|
||||
{
|
||||
this.itemHandler = itemHandler;
|
||||
@@ -82,8 +80,8 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
public IAEItemStack injectItems( IAEItemStack iox, Actionable type, IActionSource src )
|
||||
{
|
||||
// Try to reuse the cached stack
|
||||
@Nullable ItemStack currentCached = stackCache;
|
||||
stackCache = null;
|
||||
@Nullable ItemStack currentCached = iox.getCachedItemStack();
|
||||
iox.setCachedItemStack(null);
|
||||
|
||||
ItemStack orgInput;
|
||||
int slotCount = this.itemHandler.getSlots();
|
||||
@@ -108,9 +106,9 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
}
|
||||
|
||||
// Store the stack in the cache for next time.
|
||||
if( !remaining.isEmpty() && remaining != orgInput )
|
||||
if( !remaining.isEmpty() )
|
||||
{
|
||||
stackCache = remaining;
|
||||
iox.setCachedItemStack( remaining );
|
||||
}
|
||||
|
||||
// At this point, we still have some items left...
|
||||
|
||||
@@ -53,6 +53,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
private String displayName;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private List<String> tooltip;
|
||||
private ItemStack cachedItemStack;
|
||||
|
||||
private AEItemStack(final AEItemStack is) {
|
||||
this.setStackSize(is.getStackSize());
|
||||
@@ -250,6 +251,18 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
return this.isSameType(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCachedItemStack()
|
||||
{
|
||||
return this.cachedItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCachedItemStack( ItemStack is )
|
||||
{
|
||||
this.cachedItemStack = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getStackSize() + "x" + this.getDefinition().getItem().getRegistryName();
|
||||
|
||||
Reference in New Issue
Block a user