Rebuild itemlist only once per tick

re-enabled level-emitters update
This commit is contained in:
Salomão
2021-02-15 15:41:48 -03:00
parent c43cbbef43
commit 7834028459
3 changed files with 7 additions and 2 deletions
@@ -173,6 +173,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
@Override @Override
public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final IActionSource actionSource ) public void postChange( final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change, final IActionSource actionSource )
{ {
this.updateReportingValue( (IMEMonitor<IAEFluidStack>) monitor );
} }
@Override @Override
+5 -2
View File
@@ -64,6 +64,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
private boolean hasChanged = false; private boolean hasChanged = false;
@Nonnegative @Nonnegative
private int localDepthSemaphore = 0; private int localDepthSemaphore = 0;
private boolean ticked;
public NetworkMonitor( final GridStorageCache cache, final IStorageChannel<T> chan ) public NetworkMonitor( final GridStorageCache cache, final IStorageChannel<T> chan )
{ {
@@ -139,9 +140,10 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
@Override @Override
public IItemList<T> getStorageList() public IItemList<T> getStorageList()
{ {
if( this.hasChanged ) if( hasChanged && ticked )
{ {
this.hasChanged = false; hasChanged = false;
ticked = false;
this.cachedList.resetStatus(); this.cachedList.resetStatus();
return this.getAvailableItems( this.cachedList ); return this.getAvailableItems( this.cachedList );
} }
@@ -326,6 +328,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
void onTick() void onTick()
{ {
ticked = true;
if( this.sendEvent ) if( this.sendEvent )
{ {
this.sendEvent = false; this.sendEvent = false;
@@ -400,6 +400,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
@Override @Override
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource actionSource ) public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource actionSource )
{ {
this.updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
} }
@Override @Override