Revert "fixes item showing incorrect amounts"

This reverts commit 618e9390c6.
This commit is contained in:
PrototypeTrousers
2021-09-11 22:38:26 -03:00
parent cc5377d53b
commit 9335daff7d
3 changed files with 32 additions and 1 deletions
+2
View File
@@ -249,6 +249,8 @@ public class GridStorageCache implements IStorageGrid
}
tracker.applyChanges();
this.storageMonitors.forEach( ( channel, monitor ) -> monitor.forceUpdate() );
}
private <T extends IAEStack<T>, C extends IStorageChannel<T>> void postChangesToNetwork( final C chan, final int upOrDown, final IItemList<T> availableItems, final IActionSource src )
+29
View File
@@ -61,6 +61,7 @@ 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;
@Nonnegative
private int localDepthSemaphore = 0;
private long gridItemCount;
@@ -152,6 +153,13 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
@Override
public IItemList<T> getStorageList()
{
if( forceUpdate )
{
forceUpdate = false;
this.cachedList.resetStatus();
return this.getAvailableItems( this.cachedList );
}
return this.cachedList;
}
@@ -282,6 +290,27 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
}
}
void forceUpdate()
{
this.forceUpdate = true;
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.getListeners();
while ( i.hasNext() )
{
final Entry<IMEMonitorHandlerReceiver<T>, Object> o = i.next();
final IMEMonitorHandlerReceiver<T> receiver = o.getKey();
if( receiver.isValid( o.getValue() ) )
{
receiver.onListUpdate();
}
else
{
i.remove();
}
}
}
void onTick()
{
if( this.sendEvent )