Puts everywhere brackets
This commit is contained in:
@@ -544,13 +544,17 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
{
|
||||
int comparison = ItemSorters.compareLong( nextCluster.getCoProcessors(), firstCluster.getCoProcessors() );
|
||||
if( comparison != 0 )
|
||||
{
|
||||
return comparison;
|
||||
}
|
||||
return ItemSorters.compareLong( nextCluster.getAvailableStorage(), firstCluster.getAvailableStorage() );
|
||||
}
|
||||
|
||||
int comparison = ItemSorters.compareLong( firstCluster.getCoProcessors(), nextCluster.getCoProcessors() );
|
||||
if( comparison != 0 )
|
||||
{
|
||||
return comparison;
|
||||
}
|
||||
return ItemSorters.compareLong( firstCluster.getAvailableStorage(), nextCluster.getAvailableStorage() );
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -129,11 +129,15 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
{
|
||||
case PROVIDE_POWER:
|
||||
if( ev.storage.getPowerFlow() != AccessRestriction.WRITE )
|
||||
{
|
||||
this.providers.add( ev.storage );
|
||||
}
|
||||
break;
|
||||
case REQUEST_POWER:
|
||||
if( ev.storage.getPowerFlow() != AccessRestriction.READ )
|
||||
{
|
||||
this.requesters.add( ev.storage );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -183,18 +187,26 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
|
||||
// ticks since change..
|
||||
if( currentlyHasPower == this.hasPower )
|
||||
{
|
||||
this.ticksSinceHasPowerChange++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ticksSinceHasPowerChange = 0;
|
||||
}
|
||||
|
||||
// update status..
|
||||
this.hasPower = currentlyHasPower;
|
||||
|
||||
// update public status, this buffers power ups for 30 ticks.
|
||||
if( this.hasPower && this.ticksSinceHasPowerChange > 30 )
|
||||
{
|
||||
this.publicPowerState( true, this.myGrid );
|
||||
}
|
||||
else if( !this.hasPower )
|
||||
{
|
||||
this.publicPowerState( false, this.myGrid );
|
||||
}
|
||||
|
||||
this.availableTicksSinceUpdate++;
|
||||
}
|
||||
@@ -215,7 +227,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
private void publicPowerState( boolean newState, IGrid grid )
|
||||
{
|
||||
if( this.publicHasPower == newState )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.publicHasPower = newState;
|
||||
( (Grid) this.myGrid ).setImportantFlag( 0, this.publicHasPower );
|
||||
@@ -230,14 +244,18 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
this.availableTicksSinceUpdate = 0;
|
||||
this.globalAvailablePower = 0;
|
||||
for( IAEPowerStorage p : this.providers )
|
||||
{
|
||||
this.globalAvailablePower += p.getAECurrentPower();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen )
|
||||
{
|
||||
if( !seen.add( this ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double extractedPower = this.extra;
|
||||
|
||||
@@ -249,7 +267,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
{
|
||||
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
|
||||
while( extractedPower < amt && i.hasNext() )
|
||||
{
|
||||
extractedPower += i.next().extractAEPower( amt - extractedPower, mode, seen );
|
||||
}
|
||||
}
|
||||
|
||||
return extractedPower;
|
||||
@@ -274,7 +294,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
{
|
||||
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
|
||||
while( extractedPower < amt && i.hasNext() )
|
||||
{
|
||||
extractedPower += i.next().extractAEPower( amt - extractedPower, mode, seen );
|
||||
}
|
||||
}
|
||||
|
||||
// go less or the correct amount?
|
||||
@@ -287,7 +309,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
public double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen )
|
||||
{
|
||||
if( !seen.add( this ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double ignore = this.extra;
|
||||
amt += this.extra;
|
||||
@@ -303,7 +327,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
|
||||
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
|
||||
while( amt > 0 && i.hasNext() )
|
||||
{
|
||||
amt = i.next().injectAEPower( amt, mode, seen );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,7 +371,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
public double getEnergyDemand( double maxRequired, Set<IEnergyGrid> seen )
|
||||
{
|
||||
if( !seen.add( this ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double required = this.buffer() - this.extra;
|
||||
|
||||
@@ -354,7 +382,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
{
|
||||
IAEPowerStorage node = it.next();
|
||||
if( node.getPowerFlow() != AccessRestriction.READ )
|
||||
{
|
||||
required += Math.max( 0.0, node.getAEMaxPower() - node.getAECurrentPower() );
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<IEnergyGridProvider> ix = this.energyGridProviders.iterator();
|
||||
@@ -460,7 +490,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
public double getStoredPower()
|
||||
{
|
||||
if( this.availableTicksSinceUpdate > 90 )
|
||||
{
|
||||
this.refreshPower();
|
||||
}
|
||||
|
||||
return Math.max( 0.0, this.globalAvailablePower );
|
||||
}
|
||||
@@ -482,7 +514,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
public void removeNode( IGridNode node, IGridHost machine )
|
||||
{
|
||||
if( machine instanceof IEnergyGridProvider )
|
||||
{
|
||||
this.energyGridProviders.remove( machine );
|
||||
}
|
||||
|
||||
// idle draw.
|
||||
GridNode gridNode = (GridNode) node;
|
||||
@@ -501,10 +535,14 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
if( this.lastProvider == machine )
|
||||
{
|
||||
this.lastProvider = null;
|
||||
}
|
||||
|
||||
if( this.lastRequester == machine )
|
||||
{
|
||||
this.lastRequester = null;
|
||||
}
|
||||
|
||||
this.providers.remove( machine );
|
||||
this.requesters.remove( machine );
|
||||
@@ -526,7 +564,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
public void addNode( IGridNode node, IGridHost machine )
|
||||
{
|
||||
if( machine instanceof IEnergyGridProvider )
|
||||
{
|
||||
this.energyGridProviders.add( (IEnergyGridProvider) machine );
|
||||
}
|
||||
|
||||
// idle draw...
|
||||
GridNode gridNode = (GridNode) node;
|
||||
@@ -555,7 +595,9 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
if( current < max && ps.getPowerFlow() != AccessRestriction.READ )
|
||||
{
|
||||
this.requesters.add( ps );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
this.myGrid.postEvent( new MENetworkCellArrayUpdate() );
|
||||
if( node.isActive() )
|
||||
{
|
||||
this.addCellProvider( cc, new CellChangeTracker() ).applyChanges();
|
||||
}
|
||||
}
|
||||
|
||||
if( machine instanceof IStackWatcherHost )
|
||||
@@ -153,7 +155,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
BaseActionSource actionSrc = new BaseActionSource();
|
||||
if( cc instanceof IActionHost )
|
||||
{
|
||||
actionSrc = new MachineSource( (IActionHost) cc );
|
||||
}
|
||||
|
||||
for( IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
|
||||
{
|
||||
@@ -178,7 +182,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
BaseActionSource actionSrc = new BaseActionSource();
|
||||
if( cc instanceof IActionHost )
|
||||
{
|
||||
actionSrc = new MachineSource( (IActionHost) cc );
|
||||
}
|
||||
|
||||
for( IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
|
||||
{
|
||||
@@ -214,15 +220,23 @@ public class GridStorageCache implements IStorageGrid
|
||||
{
|
||||
IGridNode node = ( (IActionHost) cc ).getActionableNode();
|
||||
if( node != null && node.isActive() )
|
||||
{
|
||||
Active = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Active = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( Active )
|
||||
{
|
||||
this.addCellProvider( cc, tracker );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeCellProvider( cc, tracker );
|
||||
}
|
||||
}
|
||||
|
||||
this.itemMonitor.forceUpdate();
|
||||
@@ -248,7 +262,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
public IMEInventoryHandler<IAEItemStack> getItemInventoryHandler()
|
||||
{
|
||||
if( this.myItemNetwork == null )
|
||||
{
|
||||
this.buildNetworkStorage( StorageChannel.ITEMS );
|
||||
}
|
||||
return this.myItemNetwork;
|
||||
}
|
||||
|
||||
@@ -263,7 +279,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
for( ICellProvider cc : this.activeCellProviders )
|
||||
{
|
||||
for( IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) )
|
||||
{
|
||||
this.myFluidNetwork.addNewStorage( h );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEMS:
|
||||
@@ -271,7 +289,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
for( ICellProvider cc : this.activeCellProviders )
|
||||
{
|
||||
for( IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) )
|
||||
{
|
||||
this.myItemNetwork.addNewStorage( h );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -281,7 +301,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
public IMEInventoryHandler<IAEFluidStack> getFluidInventoryHandler()
|
||||
{
|
||||
if( this.myFluidNetwork == null )
|
||||
{
|
||||
this.buildNetworkStorage( StorageChannel.FLUIDS );
|
||||
}
|
||||
return this.myFluidNetwork;
|
||||
}
|
||||
|
||||
@@ -289,9 +311,13 @@ public class GridStorageCache implements IStorageGrid
|
||||
public void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src )
|
||||
{
|
||||
if( chan == StorageChannel.ITEMS )
|
||||
{
|
||||
this.itemMonitor.postChange( true, (Iterable<IAEItemStack>) input, src );
|
||||
}
|
||||
else if( chan == StorageChannel.FLUIDS )
|
||||
{
|
||||
this.fluidMonitor.postChange( true, (Iterable<IAEFluidStack>) input, src );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -335,11 +361,17 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.src = actionSrc;
|
||||
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
{
|
||||
this.list = ( (IMEInventoryHandler<IAEItemStack>) h ).getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
}
|
||||
else if( channel == StorageChannel.FLUIDS )
|
||||
{
|
||||
this.list = ( (IMEInventoryHandler<IAEFluidStack>) h ).getAvailableItems( AEApi.instance().storage().createFluidList() );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.list = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyChanges()
|
||||
@@ -362,7 +394,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
public void applyChanges()
|
||||
{
|
||||
for( CellChangeTrackerRecord rec : this.data )
|
||||
{
|
||||
rec.applyChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,9 +62,13 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
IMEMonitorHandlerReceiver<T> receiver = o.getKey();
|
||||
|
||||
if( receiver.isValid( o.getValue() ) )
|
||||
{
|
||||
receiver.onListUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +104,9 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
protected void postChange( boolean Add, Iterable<T> changes, BaseActionSource src )
|
||||
{
|
||||
if( DEPTH.contains( this ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEPTH.push( this );
|
||||
|
||||
@@ -114,7 +120,9 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
T difference = changedItem;
|
||||
|
||||
if( !Add && changedItem != null )
|
||||
{
|
||||
( difference = changedItem.copy() ).setStackSize( -changedItem.getStackSize() );
|
||||
}
|
||||
|
||||
if( this.myGridCache.interestManager.containsKey( changedItem ) )
|
||||
{
|
||||
@@ -131,7 +139,9 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
this.myGridCache.interestManager.enableTransactions();
|
||||
|
||||
for( ItemWatcher iw : list )
|
||||
{
|
||||
iw.getHost().onStackChange( myStorageList, fullStack, difference, src, this.getChannel() );
|
||||
}
|
||||
|
||||
this.myGridCache.interestManager.disableTransactions();
|
||||
}
|
||||
@@ -140,6 +150,8 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
|
||||
final NetworkMonitor<?> last = DEPTH.pop();
|
||||
if( last != this )
|
||||
{
|
||||
throw new IllegalStateException( "Invalid Access to Networked Storage API detected." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -59,7 +59,9 @@ public class P2PCache implements IGridCache
|
||||
for( PartP2PTunnel me : this.inputs.values() )
|
||||
{
|
||||
if( me instanceof PartP2PTunnelME )
|
||||
{
|
||||
tm.wakeDevice( me.getGridNode() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +72,9 @@ public class P2PCache implements IGridCache
|
||||
for( PartP2PTunnel me : this.inputs.values() )
|
||||
{
|
||||
if( me instanceof PartP2PTunnelME )
|
||||
{
|
||||
tm.wakeDevice( me.getGridNode() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +92,9 @@ public class P2PCache implements IGridCache
|
||||
if( machine instanceof PartP2PTunnelME )
|
||||
{
|
||||
if( !node.hasFlag( GridFlags.REQUIRE_CHANNEL ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PartP2PTunnel t = (PartP2PTunnel) machine;
|
||||
@@ -96,9 +102,13 @@ public class P2PCache implements IGridCache
|
||||
// );
|
||||
|
||||
if( t.output )
|
||||
{
|
||||
this.outputs.remove( t.freq, t );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inputs.remove( t.freq );
|
||||
}
|
||||
|
||||
this.updateTunnel( t.freq, !t.output, false );
|
||||
}
|
||||
@@ -112,7 +122,9 @@ public class P2PCache implements IGridCache
|
||||
if( machine instanceof PartP2PTunnelME )
|
||||
{
|
||||
if( !node.hasFlag( GridFlags.REQUIRE_CHANNEL ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PartP2PTunnel t = (PartP2PTunnel) machine;
|
||||
@@ -120,9 +132,13 @@ public class P2PCache implements IGridCache
|
||||
// );
|
||||
|
||||
if( t.output )
|
||||
{
|
||||
this.outputs.put( t.freq, t );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inputs.put( t.freq, t );
|
||||
}
|
||||
|
||||
this.updateTunnel( t.freq, !t.output, false );
|
||||
}
|
||||
@@ -151,7 +167,9 @@ public class P2PCache implements IGridCache
|
||||
for( PartP2PTunnel p : this.outputs.get( freq ) )
|
||||
{
|
||||
if( configChange )
|
||||
{
|
||||
p.onTunnelConfigChange();
|
||||
}
|
||||
p.onTunnelNetworkChange();
|
||||
}
|
||||
|
||||
@@ -159,7 +177,9 @@ public class P2PCache implements IGridCache
|
||||
if( in != null )
|
||||
{
|
||||
if( configChange )
|
||||
{
|
||||
in.onTunnelConfigChange();
|
||||
}
|
||||
in.onTunnelNetworkChange();
|
||||
}
|
||||
}
|
||||
@@ -167,17 +187,25 @@ public class P2PCache implements IGridCache
|
||||
public void updateFreq( PartP2PTunnel t, long NewFreq )
|
||||
{
|
||||
if( this.outputs.containsValue( t ) )
|
||||
{
|
||||
this.outputs.remove( t.freq, t );
|
||||
}
|
||||
|
||||
if( this.inputs.containsValue( t ) )
|
||||
{
|
||||
this.inputs.remove( t.freq );
|
||||
}
|
||||
|
||||
t.freq = NewFreq;
|
||||
|
||||
if( t.output )
|
||||
{
|
||||
this.outputs.put( t.freq, t );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inputs.put( t.freq, t );
|
||||
}
|
||||
|
||||
// AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq
|
||||
// );
|
||||
@@ -189,11 +217,15 @@ public class P2PCache implements IGridCache
|
||||
{
|
||||
PartP2PTunnel in = this.inputs.get( freq );
|
||||
if( in == null )
|
||||
{
|
||||
return this.NullColl;
|
||||
}
|
||||
|
||||
TunnelCollection<PartP2PTunnel> out = this.inputs.get( freq ).getCollection( this.outputs.get( freq ), c );
|
||||
if( out == null )
|
||||
{
|
||||
return this.NullColl;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,9 @@ public class PathGridCache implements IPathingGrid
|
||||
if( this.updateNetwork )
|
||||
{
|
||||
if( !this.booting )
|
||||
{
|
||||
this.myGrid.postEvent( new MENetworkBootingStatusChange() );
|
||||
}
|
||||
|
||||
this.booting = true;
|
||||
this.updateNetwork = false;
|
||||
@@ -116,7 +118,9 @@ public class PathGridCache implements IPathingGrid
|
||||
int requiredChannels = this.calculateRequiredChannels();
|
||||
int used = requiredChannels;
|
||||
if( requiredChannels > 8 )
|
||||
{
|
||||
used = 0;
|
||||
}
|
||||
|
||||
int nodes = this.myGrid.getNodes().size();
|
||||
this.channelsInUse = used;
|
||||
@@ -209,10 +213,14 @@ public class PathGridCache implements IPathingGrid
|
||||
EnumSet<GridFlags> flags = gridNode.getGridBlock().getFlags();
|
||||
|
||||
if( flags.contains( GridFlags.REQUIRE_CHANNEL ) )
|
||||
{
|
||||
this.requireChannels.remove( gridNode );
|
||||
}
|
||||
|
||||
if( flags.contains( GridFlags.CANNOT_CARRY_COMPRESSED ) )
|
||||
{
|
||||
this.blockDense.remove( gridNode );
|
||||
}
|
||||
|
||||
this.repath();
|
||||
}
|
||||
@@ -229,10 +237,14 @@ public class PathGridCache implements IPathingGrid
|
||||
EnumSet<GridFlags> flags = gridNode.getGridBlock().getFlags();
|
||||
|
||||
if( flags.contains( GridFlags.REQUIRE_CHANNEL ) )
|
||||
{
|
||||
this.requireChannels.add( gridNode );
|
||||
}
|
||||
|
||||
if( flags.contains( GridFlags.CANNOT_CARRY_COMPRESSED ) )
|
||||
{
|
||||
this.blockDense.add( gridNode );
|
||||
}
|
||||
|
||||
this.repath();
|
||||
}
|
||||
@@ -279,9 +291,13 @@ public class PathGridCache implements IPathingGrid
|
||||
startingNode.beginVisit( cv );
|
||||
|
||||
if( cv.isValid && cv.found == this.controllers.size() )
|
||||
{
|
||||
this.controllerState = ControllerState.CONTROLLER_ONLINE;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.controllerState = ControllerState.CONTROLLER_CONFLICT;
|
||||
}
|
||||
}
|
||||
|
||||
if( old != this.controllerState )
|
||||
@@ -303,7 +319,9 @@ public class PathGridCache implements IPathingGrid
|
||||
EnumSet<GridFlags> flags = gb.getFlags();
|
||||
|
||||
if( flags.contains( GridFlags.COMPRESSED_CHANNEL ) && !this.blockDense.isEmpty() )
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
|
||||
depth++;
|
||||
|
||||
@@ -312,7 +330,9 @@ public class PathGridCache implements IPathingGrid
|
||||
IGridMultiblock gmb = (IGridMultiblock) gb;
|
||||
Iterator<IGridNode> i = gmb.getMultiblockNodes();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
this.semiOpen.add( (IPathItem) i.next() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,7 +350,9 @@ public class PathGridCache implements IPathingGrid
|
||||
{
|
||||
Set<Integer> players = new HashSet<Integer>();
|
||||
for( IGridNode n : this.requireChannels )
|
||||
{
|
||||
players.add( n.getPlayerID() );
|
||||
}
|
||||
|
||||
for( int id : players )
|
||||
{
|
||||
@@ -344,13 +366,19 @@ public class PathGridCache implements IPathingGrid
|
||||
private Achievements getAchievementBracket( int ch )
|
||||
{
|
||||
if( ch < 8 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( ch < 128 )
|
||||
{
|
||||
return Achievements.Networking1;
|
||||
}
|
||||
|
||||
if( ch < 2048 )
|
||||
{
|
||||
return Achievements.Networking2;
|
||||
}
|
||||
|
||||
return Achievements.Networking3;
|
||||
}
|
||||
@@ -361,9 +389,13 @@ public class PathGridCache implements IPathingGrid
|
||||
IGridNode gridNode = ev.node;
|
||||
|
||||
if( gridNode.getGridBlock().getFlags().contains( GridFlags.REQUIRE_CHANNEL ) )
|
||||
{
|
||||
this.requireChannels.add( gridNode );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.requireChannels.remove( gridNode );
|
||||
}
|
||||
|
||||
this.repath();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ public class SecurityCache implements ISecurityGrid
|
||||
{
|
||||
this.playerPerms.clear();
|
||||
if( this.securityProvider.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.securityProvider.get( 0 ).readPermissions( this.playerPerms );
|
||||
}
|
||||
@@ -88,15 +90,21 @@ public class SecurityCache implements ISecurityGrid
|
||||
long lastCode = this.securityKey;
|
||||
|
||||
if( this.securityProvider.size() == 1 )
|
||||
{
|
||||
this.securityKey = this.securityProvider.get( 0 ).getSecurityKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.securityKey = -1;
|
||||
}
|
||||
|
||||
if( lastCode != this.securityKey )
|
||||
{
|
||||
this.myGrid.postEvent( new MENetworkSecurityChange() );
|
||||
for( IGridNode n : this.myGrid.getNodes() )
|
||||
{
|
||||
( (GridNode) n ).lastSecurityKey = this.securityKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +117,9 @@ public class SecurityCache implements ISecurityGrid
|
||||
this.updateSecurityKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
( (GridNode) gridNode ).lastSecurityKey = this.securityKey;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,9 +162,13 @@ public class SecurityCache implements ISecurityGrid
|
||||
if( perms == null )
|
||||
{
|
||||
if( playerID == -1 ) // no default?
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.hasPermission( -1, perm );
|
||||
}
|
||||
}
|
||||
|
||||
return perms.contains( perm );
|
||||
@@ -166,7 +180,9 @@ public class SecurityCache implements ISecurityGrid
|
||||
public int getOwner()
|
||||
{
|
||||
if( this.isAvailable() )
|
||||
{
|
||||
return this.securityProvider.get( 0 ).getOwner();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,9 @@ public class SpatialPylonCache implements ISpatialCache
|
||||
{
|
||||
SpatialPylonCluster c = ( (TileSpatialPylon) gm.getMachine() ).getCluster();
|
||||
if( c != null )
|
||||
{
|
||||
this.clusters.put( c, c );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,9 +101,13 @@ public class SpatialPylonCache implements ISpatialCache
|
||||
for( SpatialPylonCluster cl : this.clusters.values() )
|
||||
{
|
||||
if( this.captureMax == null )
|
||||
{
|
||||
this.captureMax = cl.max.copy();
|
||||
}
|
||||
if( this.captureMin == null )
|
||||
{
|
||||
this.captureMin = cl.min.copy();
|
||||
}
|
||||
|
||||
pylonBlocks += cl.tileCount();
|
||||
|
||||
@@ -151,9 +157,13 @@ public class SpatialPylonCache implements ISpatialCache
|
||||
this.efficiency = (double) pylonBlocks / (double) requirePylonBlocks;
|
||||
|
||||
if( this.efficiency > 1.0 )
|
||||
{
|
||||
this.efficiency = 1.0;
|
||||
}
|
||||
if( this.efficiency < 0.0 )
|
||||
{
|
||||
this.efficiency = 0.0;
|
||||
}
|
||||
|
||||
minPower = (double) reqX * (double) reqY * reqZ * AEConfig.instance.spatialPowerMultiplier;
|
||||
maxPower = Math.pow( minPower, AEConfig.instance.spatialPowerExponent );
|
||||
@@ -167,7 +177,9 @@ public class SpatialPylonCache implements ISpatialCache
|
||||
boolean myWasValid = cl.isValid;
|
||||
cl.isValid = this.isValid;
|
||||
if( myWasValid != this.isValid )
|
||||
{
|
||||
cl.updateStatus( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,10 +62,14 @@ public class TickManagerCache implements ITickManager
|
||||
TickTracker tt = this.awake.get( node );
|
||||
|
||||
if( tt == null )
|
||||
{
|
||||
tt = this.sleeping.get( node );
|
||||
}
|
||||
|
||||
if( tt == null )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return tt.getAvgNanos();
|
||||
}
|
||||
@@ -111,10 +115,14 @@ public class TickManagerCache implements ITickManager
|
||||
}
|
||||
|
||||
if( this.awake.containsKey( tt.node ) )
|
||||
{
|
||||
this.addToQueue( tt );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return; // done!
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
@@ -154,10 +162,14 @@ public class TickManagerCache implements ITickManager
|
||||
TickTracker tt = new TickTracker( tr, gridNode, (IGridTickable) machine, this.currentTick, this );
|
||||
|
||||
if( tr.canBeAlerted )
|
||||
{
|
||||
this.alertable.put( gridNode, tt );
|
||||
}
|
||||
|
||||
if( tr.isSleeping )
|
||||
{
|
||||
this.sleeping.put( gridNode, tt );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.awake.put( gridNode, tt );
|
||||
@@ -190,7 +202,9 @@ public class TickManagerCache implements ITickManager
|
||||
{
|
||||
TickTracker tt = this.alertable.get( node );
|
||||
if( tt == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// throw new RuntimeException(
|
||||
// "Invalid alerted device, this node is not marked as alertable, or part of this grid." );
|
||||
|
||||
|
||||
@@ -62,10 +62,14 @@ public class TickTracker implements Comparable<TickTracker>
|
||||
this.current_rate = rate;
|
||||
|
||||
if( this.current_rate < this.request.minTickRate )
|
||||
{
|
||||
this.current_rate = this.request.minTickRate;
|
||||
}
|
||||
|
||||
if( this.current_rate > this.request.maxTickRate )
|
||||
{
|
||||
this.current_rate = this.request.maxTickRate;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,6 +97,8 @@ public class TickTracker implements Comparable<TickTracker>
|
||||
|
||||
DimensionalCoord dc = this.node.getGridBlock().getLocation();
|
||||
if( dc != null )
|
||||
{
|
||||
crashreportcategory.addCrashSection( "Location", dc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,9 @@ public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
if( this.tunnelSources == null )
|
||||
{
|
||||
return new NullIterator<T>();
|
||||
}
|
||||
return new TunnelIterator<T>( this.tunnelSources, this.clz );
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,9 @@ public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
|
||||
{
|
||||
this.Next = this.wrapped.next();
|
||||
if( !this.targetType.isInstance( this.Next ) )
|
||||
{
|
||||
this.Next = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user