Fixed strange behavior when using storage buses with vanilla furnaces.

This commit is contained in:
AlgorithmX2 2014-08-01 00:44:44 -05:00
parent 1c266fc91a
commit 12838c6b7a

View file

@ -150,11 +150,33 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return super.getInventoryByName( name ); return super.getInventoryByName( name );
} }
private byte resetCacheLogic = 0;
private void resetCache(boolean fullReset) private void resetCache(boolean fullReset)
{ {
if ( host == null || host.getTile() == null || host.getTile().getWorldObj() == null || host.getTile().getWorldObj().isRemote ) if ( host == null || host.getTile() == null || host.getTile().getWorldObj() == null || host.getTile().getWorldObj().isRemote )
return; 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<IAEItemStack> in = getInternalHandler(); IMEInventory<IAEItemStack> in = getInternalHandler();
IItemList<IAEItemStack> before = AEApi.instance().storage().createItemList(); IItemList<IAEItemStack> before = AEApi.instance().storage().createItemList();
if ( in != null ) if ( in != null )
@ -368,12 +390,15 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override @Override
public TickingRequest getTickingRequest(IGridNode node) 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 @Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
{ {
if ( resetCacheLogic != 0 )
resetCache();
if ( monitor != null ) if ( monitor != null )
return monitor.onTick(); return monitor.onTick();