item/fluid count changes.. again
This commit is contained in:
@@ -458,6 +458,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
if( cfg != hasConfig )
|
||||
{
|
||||
resetConfigCache = true;
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
}
|
||||
else if( inventory == this.tanks )
|
||||
|
||||
@@ -185,6 +185,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if( cfg != hasConfig )
|
||||
{
|
||||
resetConfigCache = true;
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
}
|
||||
else if( inv == this.patterns && ( !removed.isEmpty() || !added.isEmpty() ) )
|
||||
|
||||
+1
-2
@@ -247,10 +247,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.removeCellProvider( cc, tracker );
|
||||
}
|
||||
}
|
||||
tracker.applyChanges();
|
||||
|
||||
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() );
|
||||
|
||||
tracker.applyChanges();
|
||||
}
|
||||
|
||||
private <T extends IAEStack<T>, C extends IStorageChannel<T>> void postChangesToNetwork( final C chan, final int upOrDown, final IItemList<T> availableItems, final IActionSource src )
|
||||
|
||||
+16
-20
@@ -45,7 +45,7 @@ import java.util.Map.Entry;
|
||||
public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
{
|
||||
@Nonnull
|
||||
private static final HashMap<IActionSource, Set<NetworkMonitor<?>>> src2MonitorsMap = new HashMap<>();
|
||||
private static final HashMap<IActionSource, LinkedList<NetworkMonitor<?>>> src2MonitorsMap = new HashMap<>();
|
||||
private static final Set<IActionSource> nestingSources = new HashSet<>();
|
||||
|
||||
protected boolean wasNested = false;
|
||||
@@ -61,7 +61,6 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
private final Object2ObjectMap<IMEMonitorHandlerReceiver<T>, Object> listeners;
|
||||
|
||||
private boolean sendEvent = false;
|
||||
private boolean forceUpdate = false;
|
||||
private long gridItemCount;
|
||||
private long gridFluidCount;
|
||||
|
||||
@@ -226,19 +225,14 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
|
||||
protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src )
|
||||
{
|
||||
src2MonitorsMap.putIfAbsent( src, new HashSet<>() );
|
||||
isNested = false;
|
||||
if( nestingSources.contains( src ) )
|
||||
{
|
||||
forceUpdate = true;
|
||||
}
|
||||
if( !src2MonitorsMap.get( src ).add( this ) )
|
||||
src2MonitorsMap.putIfAbsent( src, new LinkedList<>() );
|
||||
if( src2MonitorsMap.get( src ).contains( this ) )
|
||||
{
|
||||
nestingSources.add( src );
|
||||
forceUpdate = true;
|
||||
src2MonitorsMap.get( src ).forEach( networkMonitor -> networkMonitor.isNested = true );
|
||||
return;
|
||||
}
|
||||
src2MonitorsMap.get( src ).add( this );
|
||||
isNested = false;
|
||||
|
||||
this.sendEvent = true;
|
||||
|
||||
@@ -282,23 +276,25 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
|
||||
this.notifyListenersOfChange( changes, src );
|
||||
|
||||
src2MonitorsMap.get( src ).remove( this );
|
||||
if( src2MonitorsMap.get( src ).isEmpty() )
|
||||
if( src2MonitorsMap.get( src ).getFirst() == this )
|
||||
{
|
||||
boolean nested = nestingSources.contains( src );
|
||||
src2MonitorsMap.get( src ).forEach( networkMonitor -> networkMonitor.isNested = nested );
|
||||
|
||||
src2MonitorsMap.get( src ).forEach( networkMonitor -> {
|
||||
if( networkMonitor.isNested != networkMonitor.wasNested )
|
||||
{
|
||||
networkMonitor.wasNested = networkMonitor.isNested;
|
||||
networkMonitor.forceUpdate();
|
||||
}
|
||||
} );
|
||||
src2MonitorsMap.remove( src );
|
||||
nestingSources.remove( src );
|
||||
}
|
||||
|
||||
if( isNested != wasNested || forceUpdate )
|
||||
{
|
||||
wasNested = isNested;
|
||||
forceUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void forceUpdate()
|
||||
{
|
||||
forceUpdate = false;
|
||||
this.cachedList.resetStatus();
|
||||
this.getAvailableItems( this.cachedList );
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.fluids.parts.PartFluidInterface;
|
||||
import appeng.fluids.tile.TileFluidInterface;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
@@ -174,7 +175,8 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
|
||||
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||
if( te instanceof TileCableBus )
|
||||
{
|
||||
if( ( (TileCableBus) te ).getPart( this.getSide().getOpposite() ) instanceof PartFluidInterface )
|
||||
IPart iPart = ( (TileCableBus) te ).getPart( this.getSide().getOpposite() );
|
||||
if( iPart == null || iPart instanceof PartFluidInterface )
|
||||
{
|
||||
this.resetCache( true );
|
||||
this.resetCache();
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
@@ -326,7 +327,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||
if( te instanceof TileCableBus )
|
||||
{
|
||||
if( ( (TileCableBus) te ).getPart( this.getSide().getOpposite() ) instanceof PartInterface )
|
||||
IPart iPart = ( (TileCableBus) te ).getPart( this.getSide().getOpposite() );
|
||||
if( iPart == null || iPart instanceof PartInterface )
|
||||
{
|
||||
this.resetCache( true );
|
||||
this.resetCache();
|
||||
|
||||
Reference in New Issue
Block a user