Revamped onChange Events to post lists of items making bulk operations much less cpu intensive.
This commit is contained in:
parent
3f91868d5e
commit
5b79ad0b8c
12 changed files with 83 additions and 88 deletions
|
@ -57,9 +57,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||||
|
|
||||||
protected void setCPU(ICraftingCPU c)
|
protected void setCPU(ICraftingCPU c)
|
||||||
{
|
{
|
||||||
if ( c== monitor)
|
if ( c == monitor )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( monitor != null )
|
if ( monitor != null )
|
||||||
monitor.removeListener( this );
|
monitor.removeListener( this );
|
||||||
|
|
||||||
|
@ -185,11 +185,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource actionSource)
|
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource actionSource)
|
||||||
{
|
{
|
||||||
change = change.copy();
|
for (IAEItemStack is : change)
|
||||||
change.setStackSize( 1 );
|
{
|
||||||
list.add( change );
|
is = is.copy();
|
||||||
|
is.setStackSize( 1 );
|
||||||
|
list.add( is );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -317,9 +317,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource source)
|
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source)
|
||||||
{
|
{
|
||||||
items.add( change );
|
for (IAEItemStack is : change)
|
||||||
|
items.add( is );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
8
me/cache/CraftingGridCache.java
vendored
8
me/cache/CraftingGridCache.java
vendored
|
@ -295,8 +295,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
emitableItems.clear();
|
emitableItems.clear();
|
||||||
|
|
||||||
// update the stuff that was in the list...
|
// update the stuff that was in the list...
|
||||||
for (IAEItemStack out : oldItems.keySet())
|
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, oldItems.keySet(), new BaseActionSource() );
|
||||||
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, out, new BaseActionSource() );
|
|
||||||
|
|
||||||
// re-create list..
|
// re-create list..
|
||||||
for (ICraftingProvider cp : providers)
|
for (ICraftingProvider cp : providers)
|
||||||
|
@ -324,10 +323,9 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
|
|
||||||
// make them immutable
|
// make them immutable
|
||||||
for (Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet())
|
for (Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet())
|
||||||
{
|
|
||||||
craftableItems.put( e.getKey(), ImmutableSortedSet.copyOf( e.getValue() ) );
|
craftableItems.put( e.getKey(), ImmutableSortedSet.copyOf( e.getValue() ) );
|
||||||
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, e.getKey(), new BaseActionSource() );
|
|
||||||
}
|
sg.postAlterationOfStoredItems( StorageChannel.ITEMS, craftableItems.keySet(), new BaseActionSource() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
28
me/cache/GridStorageCache.java
vendored
28
me/cache/GridStorageCache.java
vendored
|
@ -232,28 +232,10 @@ public class GridStorageCache implements IStorageGrid
|
||||||
switch (chan)
|
switch (chan)
|
||||||
{
|
{
|
||||||
case FLUIDS:
|
case FLUIDS:
|
||||||
for (IAEFluidStack fs : ((IItemList<IAEFluidStack>) availableItems))
|
fluidMonitor.postChange( up_or_down > 0, (IItemList<IAEFluidStack>) availableItems, src );
|
||||||
{
|
|
||||||
if ( up_or_down > 0 )
|
|
||||||
fluidMonitor.postChange( fs, src );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fs.setStackSize( -fs.getStackSize() );
|
|
||||||
fluidMonitor.postChange( fs, src );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ITEMS:
|
case ITEMS:
|
||||||
for (IAEItemStack fs : ((IItemList<IAEItemStack>) availableItems))
|
itemMonitor.postChange( up_or_down > 0, (IItemList<IAEItemStack>) availableItems, src );
|
||||||
{
|
|
||||||
if ( up_or_down > 0 )
|
|
||||||
itemMonitor.postChange( fs, src );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fs.setStackSize( -fs.getStackSize() );
|
|
||||||
itemMonitor.postChange( fs, src );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
@ -274,12 +256,12 @@ public class GridStorageCache implements IStorageGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postAlterationOfStoredItems(StorageChannel chan, IAEStack input, BaseActionSource src)
|
public void postAlterationOfStoredItems(StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src)
|
||||||
{
|
{
|
||||||
if ( chan == StorageChannel.ITEMS )
|
if ( chan == StorageChannel.ITEMS )
|
||||||
itemMonitor.postChange( (IAEItemStack) input, src );
|
itemMonitor.postChange( true, (Iterable<IAEItemStack>) input, src );
|
||||||
else if ( chan == StorageChannel.FLUIDS )
|
else if ( chan == StorageChannel.FLUIDS )
|
||||||
fluidMonitor.postChange( (IAEFluidStack) input, src );
|
fluidMonitor.postChange( true, (Iterable<IAEFluidStack>) input, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
45
me/cache/NetworkMonitor.java
vendored
45
me/cache/NetworkMonitor.java
vendored
|
@ -48,8 +48,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||||
|
|
||||||
final static public LinkedList depth = new LinkedList();
|
final static public LinkedList depth = new LinkedList();
|
||||||
|
|
||||||
@Override
|
protected void postChange(boolean Add, Iterable<T> changes, BaseActionSource src)
|
||||||
protected void postChange(T diff, BaseActionSource src)
|
|
||||||
{
|
{
|
||||||
if ( depth.contains( this ) )
|
if ( depth.contains( this ) )
|
||||||
return;
|
return;
|
||||||
|
@ -57,28 +56,36 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||||
depth.push( this );
|
depth.push( this );
|
||||||
|
|
||||||
sendEvent = true;
|
sendEvent = true;
|
||||||
super.postChange( diff, src );
|
postChangeToListeners( changes, src );
|
||||||
|
|
||||||
if ( myGridCache.interestManager.containsKey( diff ) )
|
IItemList<T> myStorageList = getStorageList();
|
||||||
|
|
||||||
|
for (T changedItem : changes)
|
||||||
{
|
{
|
||||||
Set<ItemWatcher> list = myGridCache.interestManager.get( diff );
|
T diffrence = changedItem;
|
||||||
if ( !list.isEmpty() )
|
|
||||||
{
|
|
||||||
IItemList<T> myStorageList = getStorageList();
|
|
||||||
|
|
||||||
IAEStack fullStack = myStorageList.findPrecise( diff );
|
if ( !Add && changedItem != null )
|
||||||
if ( fullStack == null )
|
(diffrence = changedItem.copy()).setStackSize( -changedItem.getStackSize() );
|
||||||
|
|
||||||
|
if ( myGridCache.interestManager.containsKey( changedItem ) )
|
||||||
|
{
|
||||||
|
Set<ItemWatcher> list = myGridCache.interestManager.get( changedItem );
|
||||||
|
if ( !list.isEmpty() )
|
||||||
{
|
{
|
||||||
fullStack = diff.copy();
|
IAEStack fullStack = myStorageList.findPrecise( changedItem );
|
||||||
fullStack.setStackSize( 0 );
|
if ( fullStack == null )
|
||||||
|
{
|
||||||
|
fullStack = changedItem.copy();
|
||||||
|
fullStack.setStackSize( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
myGridCache.interestManager.enableTransactions();
|
||||||
|
|
||||||
|
for (ItemWatcher iw : list)
|
||||||
|
iw.getHost().onStackChange( myStorageList, fullStack, diffrence, src, getChannel() );
|
||||||
|
|
||||||
|
myGridCache.interestManager.disableTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
myGridCache.interestManager.enableTransactions();
|
|
||||||
|
|
||||||
for (ItemWatcher iw : list)
|
|
||||||
iw.getHost().onStackChange( myStorageList, fullStack, diff, src, getChannel() );
|
|
||||||
|
|
||||||
myGridCache.interestManager.disableTransactions();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ import appeng.tile.crafting.TileCraftingTile;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
@ -108,16 +109,18 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||||
{
|
{
|
||||||
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = getListeners();
|
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = getListeners();
|
||||||
|
|
||||||
|
ImmutableList<IAEItemStack> single = null;
|
||||||
|
|
||||||
// protect integrity
|
// protect integrity
|
||||||
if ( i.hasNext() )
|
if ( i.hasNext() )
|
||||||
diff = diff.copy();
|
single = ImmutableList.of( diff.copy() );
|
||||||
|
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next();
|
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> o = i.next();
|
||||||
IMEMonitorHandlerReceiver<IAEItemStack> recv = o.getKey();
|
IMEMonitorHandlerReceiver<IAEItemStack> recv = o.getKey();
|
||||||
if ( recv.isValid( o.getValue() ) )
|
if ( recv.isValid( o.getValue() ) )
|
||||||
recv.postChange( null, diff, src );
|
recv.postChange( null, single, src );
|
||||||
else
|
else
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
|
@ -494,8 +497,8 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||||
|
|
||||||
IItemList<IAEItemStack> list;
|
IItemList<IAEItemStack> list;
|
||||||
getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL );
|
getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL );
|
||||||
for (IAEItemStack g : list)
|
for (IAEItemStack is : list)
|
||||||
postChange( g, machineSrc );
|
postChange( is, machineSrc );
|
||||||
|
|
||||||
isComplete = true;
|
isComplete = true;
|
||||||
myLastLink = null;
|
myLastLink = null;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package appeng.me.storage;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
@ -163,6 +164,8 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||||
{
|
{
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
|
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
|
||||||
|
|
||||||
list.resetStatus();
|
list.resetStatus();
|
||||||
for (ItemSlot is : adaptor)
|
for (ItemSlot is : adaptor)
|
||||||
{
|
{
|
||||||
|
@ -178,12 +181,12 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||||
if ( old != null && old.aeStack != null )
|
if ( old != null && old.aeStack != null )
|
||||||
{
|
{
|
||||||
old.aeStack.setStackSize( -old.aeStack.getStackSize() );
|
old.aeStack.setStackSize( -old.aeStack.getStackSize() );
|
||||||
postDiffrence( old.aeStack );
|
changes.add( old.aeStack );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cis != null && cis.aeStack != null )
|
if ( cis != null && cis.aeStack != null )
|
||||||
{
|
{
|
||||||
postDiffrence( cis.aeStack );
|
changes.add( cis.aeStack );
|
||||||
list.add( cis.aeStack );
|
list.add( cis.aeStack );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,12 +211,15 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||||
|
|
||||||
IAEItemStack a = stack.copy();
|
IAEItemStack a = stack.copy();
|
||||||
a.setStackSize( diff );
|
a.setStackSize( diff );
|
||||||
postDiffrence( a );
|
changes.add( a );
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !changes.isEmpty() )
|
||||||
|
postDiffrence( changes );
|
||||||
|
|
||||||
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
|
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +234,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
|
||||||
return !Platform.isSameItemPrecise( a, b );
|
return !Platform.isSameItemPrecise( a, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postDiffrence(IAEItemStack a)
|
private void postDiffrence(Iterable<IAEItemStack> a)
|
||||||
{
|
{
|
||||||
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
|
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
|
||||||
if ( a != null )
|
if ( a != null )
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange(IBaseMonitor<T> monitor, T change, BaseActionSource source)
|
public void postChange(IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source)
|
||||||
{
|
{
|
||||||
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator();
|
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator();
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
|
|
|
@ -257,7 +257,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource actionSource)
|
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource actionSource)
|
||||||
{
|
{
|
||||||
updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
|
updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,7 +450,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, IAEItemStack change, BaseActionSource source)
|
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -304,7 +304,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange(IBaseMonitor<T> monitor, T change, BaseActionSource source)
|
public void postChange(IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source)
|
||||||
{
|
{
|
||||||
if ( source == mySrc || (source instanceof PlayerSource && ((PlayerSource) source).via == TileChest.this) )
|
if ( source == mySrc || (source instanceof PlayerSource && ((PlayerSource) source).via == TileChest.this) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -1379,28 +1380,25 @@ public class Platform
|
||||||
|
|
||||||
public static void postChanges(IStorageGrid gs, ItemStack removed, ItemStack added, BaseActionSource src)
|
public static void postChanges(IStorageGrid gs, ItemStack removed, ItemStack added, BaseActionSource src)
|
||||||
{
|
{
|
||||||
|
IItemList<IAEItemStack> itemChanges = AEApi.instance().storage().createItemList();
|
||||||
|
IItemList<IAEFluidStack> fluidChanges = AEApi.instance().storage().createFluidList();
|
||||||
|
|
||||||
if ( removed != null )
|
if ( removed != null )
|
||||||
{
|
{
|
||||||
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.ITEMS );
|
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
if ( myItems != null )
|
if ( myItems != null )
|
||||||
{
|
{
|
||||||
for (IAEItemStack is : myItems.getAvailableItems( AEApi.instance().storage().createItemList() ))
|
for (IAEItemStack is : myItems.getAvailableItems( itemChanges ))
|
||||||
{
|
|
||||||
is.setStackSize( -is.getStackSize() );
|
is.setStackSize( -is.getStackSize() );
|
||||||
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, is, src );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
|
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
|
||||||
|
|
||||||
if ( myFluids != null )
|
if ( myFluids != null )
|
||||||
{
|
{
|
||||||
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ))
|
for (IAEFluidStack is : myFluids.getAvailableItems( fluidChanges ))
|
||||||
{
|
|
||||||
is.setStackSize( -is.getStackSize() );
|
is.setStackSize( -is.getStackSize() );
|
||||||
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1409,28 +1407,22 @@ public class Platform
|
||||||
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS );
|
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
if ( myItems != null )
|
if ( myItems != null )
|
||||||
{
|
myItems.getAvailableItems( itemChanges );
|
||||||
for (IAEItemStack is : myItems.getAvailableItems( AEApi.instance().storage().createItemList() ))
|
|
||||||
{
|
|
||||||
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, is, src );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
|
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
|
||||||
|
|
||||||
if ( myFluids != null )
|
if ( myFluids != null )
|
||||||
{
|
myFluids.getAvailableItems( fluidChanges );
|
||||||
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ))
|
|
||||||
{
|
|
||||||
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, itemChanges, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public <T extends IAEStack<T>> void postListChanges(IItemList<T> before, IItemList<T> after, IMEMonitorHandlerReceiver<T> meMonitorPassthu,
|
static public <T extends IAEStack<T>> void postListChanges(IItemList<T> before, IItemList<T> after, IMEMonitorHandlerReceiver<T> meMonitorPassthu,
|
||||||
BaseActionSource source)
|
BaseActionSource source)
|
||||||
{
|
{
|
||||||
|
LinkedList<T> changes = new LinkedList();
|
||||||
|
|
||||||
for (T is : before)
|
for (T is : before)
|
||||||
is.setStackSize( -is.getStackSize() );
|
is.setStackSize( -is.getStackSize() );
|
||||||
|
|
||||||
|
@ -1441,9 +1433,12 @@ public class Platform
|
||||||
{
|
{
|
||||||
if ( is.getStackSize() != 0 )
|
if ( is.getStackSize() != 0 )
|
||||||
{
|
{
|
||||||
meMonitorPassthu.postChange( null, is, source );
|
changes.add( is );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !changes.isEmpty() )
|
||||||
|
meMonitorPassthu.postChange( null, changes, source );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int generateTileHash(TileEntity target)
|
public static int generateTileHash(TileEntity target)
|
||||||
|
|
Loading…
Reference in a new issue