item/fluid count changes.. again
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ aechannel=stable
|
|||||||
aebuild=7
|
aebuild=7
|
||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
trousers=omni-fixes-v49i
|
trousers=omni-fixes-v49j
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
|
|||||||
@@ -458,6 +458,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
if( cfg != hasConfig )
|
if( cfg != hasConfig )
|
||||||
{
|
{
|
||||||
resetConfigCache = true;
|
resetConfigCache = true;
|
||||||
|
this.notifyNeighbors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( inventory == this.tanks )
|
else if( inventory == this.tanks )
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
if( cfg != hasConfig )
|
if( cfg != hasConfig )
|
||||||
{
|
{
|
||||||
resetConfigCache = true;
|
resetConfigCache = true;
|
||||||
|
this.notifyNeighbors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( inv == this.patterns && ( !removed.isEmpty() || !added.isEmpty() ) )
|
else if( inv == this.patterns && ( !removed.isEmpty() || !added.isEmpty() ) )
|
||||||
|
|||||||
+1
-2
@@ -247,10 +247,9 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
this.removeCellProvider( cc, tracker );
|
this.removeCellProvider( cc, tracker );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tracker.applyChanges();
|
||||||
|
|
||||||
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() );
|
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 )
|
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>
|
public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||||
{
|
{
|
||||||
@Nonnull
|
@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<>();
|
private static final Set<IActionSource> nestingSources = new HashSet<>();
|
||||||
|
|
||||||
protected boolean wasNested = false;
|
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 final Object2ObjectMap<IMEMonitorHandlerReceiver<T>, Object> listeners;
|
||||||
|
|
||||||
private boolean sendEvent = false;
|
private boolean sendEvent = false;
|
||||||
private boolean forceUpdate = false;
|
|
||||||
private long gridItemCount;
|
private long gridItemCount;
|
||||||
private long gridFluidCount;
|
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 )
|
protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src )
|
||||||
{
|
{
|
||||||
src2MonitorsMap.putIfAbsent( src, new HashSet<>() );
|
src2MonitorsMap.putIfAbsent( src, new LinkedList<>() );
|
||||||
isNested = false;
|
if( src2MonitorsMap.get( src ).contains( this ) )
|
||||||
if( nestingSources.contains( src ) )
|
|
||||||
{
|
|
||||||
forceUpdate = true;
|
|
||||||
}
|
|
||||||
if( !src2MonitorsMap.get( src ).add( this ) )
|
|
||||||
{
|
{
|
||||||
nestingSources.add( src );
|
nestingSources.add( src );
|
||||||
forceUpdate = true;
|
|
||||||
src2MonitorsMap.get( src ).forEach( networkMonitor -> networkMonitor.isNested = true );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
src2MonitorsMap.get( src ).add( this );
|
||||||
|
isNested = false;
|
||||||
|
|
||||||
this.sendEvent = true;
|
this.sendEvent = true;
|
||||||
|
|
||||||
@@ -282,23 +276,25 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
|||||||
|
|
||||||
this.notifyListenersOfChange( changes, src );
|
this.notifyListenersOfChange( changes, src );
|
||||||
|
|
||||||
src2MonitorsMap.get( src ).remove( this );
|
if( src2MonitorsMap.get( src ).getFirst() == this )
|
||||||
if( src2MonitorsMap.get( src ).isEmpty() )
|
|
||||||
{
|
{
|
||||||
|
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 );
|
src2MonitorsMap.remove( src );
|
||||||
nestingSources.remove( src );
|
nestingSources.remove( src );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isNested != wasNested || forceUpdate )
|
|
||||||
{
|
|
||||||
wasNested = isNested;
|
|
||||||
forceUpdate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void forceUpdate()
|
void forceUpdate()
|
||||||
{
|
{
|
||||||
forceUpdate = false;
|
|
||||||
this.cachedList.resetStatus();
|
this.cachedList.resetStatus();
|
||||||
this.getAvailableItems( this.cachedList );
|
this.getAvailableItems( this.cachedList );
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.parts.IPart;
|
||||||
import appeng.fluids.parts.PartFluidInterface;
|
import appeng.fluids.parts.PartFluidInterface;
|
||||||
import appeng.fluids.tile.TileFluidInterface;
|
import appeng.fluids.tile.TileFluidInterface;
|
||||||
import appeng.tile.misc.TileInterface;
|
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.
|
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||||
if( te instanceof TileCableBus )
|
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( true );
|
||||||
this.resetCache();
|
this.resetCache();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import appeng.api.networking.storage.IStorageGrid;
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
|
import appeng.api.parts.IPart;
|
||||||
import appeng.me.cache.GridStorageCache;
|
import appeng.me.cache.GridStorageCache;
|
||||||
import appeng.tile.misc.TileInterface;
|
import appeng.tile.misc.TileInterface;
|
||||||
import appeng.tile.networking.TileCableBus;
|
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.
|
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||||
if( te instanceof TileCableBus )
|
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( true );
|
||||||
this.resetCache();
|
this.resetCache();
|
||||||
|
|||||||
Reference in New Issue
Block a user