From 12838c6b7afc3ef9838c98275473be5ebbc46e4f Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Fri, 1 Aug 2014 00:44:44 -0500 Subject: [PATCH] Fixed strange behavior when using storage buses with vanilla furnaces. --- parts/misc/PartStorageBus.java | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/parts/misc/PartStorageBus.java b/parts/misc/PartStorageBus.java index 7abbad2f..0f5a8a20 100644 --- a/parts/misc/PartStorageBus.java +++ b/parts/misc/PartStorageBus.java @@ -150,11 +150,33 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC return super.getInventoryByName( name ); } + private byte resetCacheLogic = 0; + private void resetCache(boolean fullReset) { if ( host == null || host.getTile() == null || host.getTile().getWorldObj() == null || host.getTile().getWorldObj().isRemote ) return; + if ( fullReset ) + resetCacheLogic = 2; + else + resetCacheLogic = 1; + + try + { + proxy.getTick().alertDevice( proxy.getNode() ); + } + catch (GridAccessException e) + { + // :P + } + } + + private void resetCache() + { + boolean fullReset = resetCacheLogic == 2; + resetCacheLogic = 0; + IMEInventory in = getInternalHandler(); IItemList before = AEApi.instance().storage().createItemList(); if ( in != null ) @@ -368,12 +390,15 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC @Override public TickingRequest getTickingRequest(IGridNode node) { - return new TickingRequest( TickRates.StorageBus.min, TickRates.StorageBus.max, monitor == null, false ); + return new TickingRequest( TickRates.StorageBus.min, TickRates.StorageBus.max, monitor == null, true ); } @Override public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) { + if ( resetCacheLogic != 0 ) + resetCache(); + if ( monitor != null ) return monitor.onTick();