level emitters cache rework

This commit is contained in:
Salomão
2021-03-30 23:05:15 -03:00
parent 2fdc16d3a8
commit 40ec517480
2 changed files with 24 additions and 52 deletions
+1 -15
View File
@@ -100,13 +100,6 @@ public class TickManagerCache implements ITickManager
this.upcomingTicks.poll(); this.upcomingTicks.poll();
final int diff = (int) ( this.currentTick - tt.getLastTick() ); final int diff = (int) ( this.currentTick - tt.getLastTick() );
if( tt.getGridTickable() instanceof PartLevelEmitter )
{
laterTicker.put( tt.getNode(), tt );
} else
{
final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff ); final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff );
switch ( mod ) switch ( mod )
@@ -131,19 +124,12 @@ public class TickManagerCache implements ITickManager
default: default:
break; break;
} }
}
if( this.awake.containsKey( tt.getNode() ) ) if( this.awake.containsKey( tt.getNode() ) )
{ {
this.addToQueue( tt ); this.addToQueue( tt );
} }
} }
Iterator<Map.Entry<IGridNode, TickTracker>> ltIterator = laterTicker.entrySet().iterator();
while ( ltIterator.hasNext() )
{
Map.Entry<IGridNode, TickTracker> tickTracker = ltIterator.next();
tickTracker.getValue().getGridTickable().tickingRequest( tickTracker.getKey(), 1 );
ltIterator.remove();
}
PartLevelEmitter.wipeCaches(); PartLevelEmitter.wipeCaches();
} }
catch( final Throwable t ) catch( final Throwable t )
@@ -90,7 +90,7 @@ import appeng.util.Platform;
import appeng.util.inv.InvOperation; import appeng.util.inv.InvOperation;
public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherHost, IStackWatcherHost, ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider, IGridTickable public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherHost, IStackWatcherHost, ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider
{ {
@PartModels @PartModels
@@ -612,20 +612,6 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
} }
} }
@Nonnull
@Override
public TickingRequest getTickingRequest( @Nonnull IGridNode node )
{
return new TickingRequest( 1,1,false,false );
}
@Nonnull
@Override
public TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall )
{
return TickRateModulation.URGENT;
}
static public void wipeCaches(){ static public void wipeCaches(){
gridItemCount = new HashMap<>(); gridItemCount = new HashMap<>();
fuzzyAEItemStackCount = new HashMap<>(); fuzzyAEItemStackCount = new HashMap<>();