Buffer changes from Interest List.

This commit is contained in:
AlgorithmX2
2014-06-10 12:16:14 -05:00
parent a73109b62e
commit d807812bc8
5 changed files with 334 additions and 246 deletions
+3 -1
View File
@@ -25,6 +25,7 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.me.helpers.StorageInterestManager;
import appeng.me.storage.ItemWatcher;
import appeng.me.storage.NetworkInventoryHandler;
@@ -34,7 +35,8 @@ import com.google.common.collect.SetMultimap;
public class GridStorageCache implements IStorageGrid
{
public SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create();
final private SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create();
final public StorageInterestManager interestManager = new StorageInterestManager( interests );
final HashSet<ICellContainer> activeCellContainers = new HashSet();
final HashSet<ICellContainer> inactiveCellContainers = new HashSet();
+7 -3
View File
@@ -59,9 +59,9 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
sendEvent = true;
super.postChange( diff, src );
if ( myGridCache.interests.containsKey( diff ) )
if ( myGridCache.interestManager.containsKey( diff ) )
{
Set<ItemWatcher> list = myGridCache.interests.get( diff );
Set<ItemWatcher> list = myGridCache.interestManager.get( diff );
if ( !list.isEmpty() )
{
IItemList<T> myStorageList = getStorageList();
@@ -72,9 +72,13 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
fullStack = diff.copy();
fullStack.setStackSize( 0 );
}
myGridCache.interestManager.enableTransactions();
for (ItemWatcher iw : list)
iw.getHost().onStackChange( myStorageList, fullStack, diff, src, getChannel() );
myGridCache.interestManager.disableTransactions();
}
}