From 92171d36d36785cca56d22bc4a1a71976d0e9aec Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Mon, 21 Jul 2014 22:50:40 -0500 Subject: [PATCH] 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 ) --- integration/modules/helpers/MFRDSU.java | 11 +++++++---- parts/misc/PartStorageBus.java | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/integration/modules/helpers/MFRDSU.java b/integration/modules/helpers/MFRDSU.java index 0acd63cf..0601c67a 100644 --- a/integration/modules/helpers/MFRDSU.java +++ b/integration/modules/helpers/MFRDSU.java @@ -37,12 +37,15 @@ public class MFRDSU implements IMEInventory if ( input.equals( is ) ) { long max = dsu.getMaxStoredCount(); - long additiona = is.stackSize; - additiona += input.getStackSize(); - if ( additiona > max ) + long storedItems = is.stackSize; + if ( max == storedItems ) + return input; + + storedItems += input.getStackSize(); + if ( storedItems > max ) { IAEItemStack overflow = AEItemStack.create( is ); - overflow.setStackSize( (int) (additiona - max) ); + overflow.setStackSize( (int) (storedItems - max) ); if ( mode == Actionable.MODULATE ) dsu.setStoredItemCount( (int) max ); return overflow; diff --git a/parts/misc/PartStorageBus.java b/parts/misc/PartStorageBus.java index 9f42ca8d..77115a90 100644 --- a/parts/misc/PartStorageBus.java +++ b/parts/misc/PartStorageBus.java @@ -166,15 +166,6 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC cached = false; if ( fullReset ) handlerHash = 0; - try - { - // force grid to update handlers... - proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); - } - catch (GridAccessException e) - { - // :3 - } IMEInventory out = getInternalHandler(); IItemList after = AEApi.instance().storage().createItemList(); @@ -237,6 +228,16 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC if ( handlerHash == newHandlerHash && handlerHash != 0 ) return handler; + try + { + // force grid to update handlers... + proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + } + catch (GridAccessException e) + { + // :3 + } + handlerHash = newHandlerHash; handler = null; monitor = null;