Storage Buses should only update the grid when their target changes.

don't set the item count via IDSU unless the count changes ( ignore full inventories )
This commit is contained in:
AlgorithmX2
2014-07-21 22:50:40 -05:00
parent 3ef02cb485
commit 92171d36d3
2 changed files with 17 additions and 13 deletions
+7 -4
View File
@@ -37,12 +37,15 @@ public class MFRDSU implements IMEInventory<IAEItemStack>
if ( input.equals( is ) ) if ( input.equals( is ) )
{ {
long max = dsu.getMaxStoredCount(); long max = dsu.getMaxStoredCount();
long additiona = is.stackSize; long storedItems = is.stackSize;
additiona += input.getStackSize(); if ( max == storedItems )
if ( additiona > max ) return input;
storedItems += input.getStackSize();
if ( storedItems > max )
{ {
IAEItemStack overflow = AEItemStack.create( is ); IAEItemStack overflow = AEItemStack.create( is );
overflow.setStackSize( (int) (additiona - max) ); overflow.setStackSize( (int) (storedItems - max) );
if ( mode == Actionable.MODULATE ) if ( mode == Actionable.MODULATE )
dsu.setStoredItemCount( (int) max ); dsu.setStoredItemCount( (int) max );
return overflow; return overflow;
+10 -9
View File
@@ -166,15 +166,6 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
cached = false; cached = false;
if ( fullReset ) if ( fullReset )
handlerHash = 0; handlerHash = 0;
try
{
// force grid to update handlers...
proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch (GridAccessException e)
{
// :3
}
IMEInventory<IAEItemStack> out = getInternalHandler(); IMEInventory<IAEItemStack> out = getInternalHandler();
IItemList<IAEItemStack> after = AEApi.instance().storage().createItemList(); IItemList<IAEItemStack> after = AEApi.instance().storage().createItemList();
@@ -237,6 +228,16 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if ( handlerHash == newHandlerHash && handlerHash != 0 ) if ( handlerHash == newHandlerHash && handlerHash != 0 )
return handler; return handler;
try
{
// force grid to update handlers...
proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch (GridAccessException e)
{
// :3
}
handlerHash = newHandlerHash; handlerHash = newHandlerHash;
handler = null; handler = null;
monitor = null; monitor = null;