final variables and parameters

This commit is contained in:
thatsIch
2015-09-30 14:24:40 +02:00
parent 059523f543
commit 8b3a954f73
732 changed files with 9253 additions and 9256 deletions
+34 -34
View File
@@ -50,16 +50,16 @@ public class Grid implements IGrid
private int priority; // how import is this network?
private GridStorage myStorage;
public Grid( GridNode center )
public Grid( final GridNode center )
{
this.pivot = center;
Map<Class<? extends IGridCache>, IGridCache> myCaches = AEApi.instance().registries().gridCache().createCacheInstance( this );
for( Entry<Class<? extends IGridCache>, IGridCache> c : myCaches.entrySet() )
final Map<Class<? extends IGridCache>, IGridCache> myCaches = AEApi.instance().registries().gridCache().createCacheInstance( this );
for( final Entry<Class<? extends IGridCache>, IGridCache> c : myCaches.entrySet() )
{
Class<? extends IGridCache> key = c.getKey();
IGridCache value = c.getValue();
Class<? extends IGridCache> valueClass = value.getClass();
final Class<? extends IGridCache> key = c.getKey();
final IGridCache value = c.getValue();
final Class<? extends IGridCache> valueClass = value.getClass();
this.eventBus.readClass( key, valueClass );
this.caches.put( key, new GridCacheWrapper( value ) );
@@ -94,23 +94,23 @@ public class Grid implements IGrid
public int size()
{
int out = 0;
for( Collection<?> x : this.machines.values() )
for( final Collection<?> x : this.machines.values() )
{
out += x.size();
}
return out;
}
public void remove( GridNode gridNode )
public void remove( final GridNode gridNode )
{
for( IGridCache c : this.caches.values() )
for( final IGridCache c : this.caches.values() )
{
IGridHost machine = gridNode.getMachine();
final IGridHost machine = gridNode.getMachine();
c.removeNode( gridNode, machine );
}
Class<? extends IGridHost> machineClass = gridNode.getMachineClass();
Set<IGridNode> nodes = this.machines.get( machineClass );
final Class<? extends IGridHost> machineClass = gridNode.getMachineClass();
final Set<IGridNode> nodes = this.machines.get( machineClass );
if( nodes != null )
{
nodes.remove( gridNode );
@@ -120,7 +120,7 @@ public class Grid implements IGrid
if( this.pivot == gridNode )
{
Iterator<IGridNode> n = this.getNodes().iterator();
final Iterator<IGridNode> n = this.getNodes().iterator();
if( n.hasNext() )
{
this.pivot = (GridNode) n.next();
@@ -134,9 +134,9 @@ public class Grid implements IGrid
}
}
public void add( GridNode gridNode )
public void add( final GridNode gridNode )
{
Class<? extends IGridHost> mClass = gridNode.getMachineClass();
final Class<? extends IGridHost> mClass = gridNode.getMachineClass();
MachineSet nodes = this.machines.get( mClass );
if( nodes == null )
@@ -149,15 +149,15 @@ public class Grid implements IGrid
// handle loading grid storages.
if( gridNode.getGridStorage() != null )
{
GridStorage gs = gridNode.getGridStorage();
IGrid grid = gs.getGrid();
final GridStorage gs = gridNode.getGridStorage();
final IGrid grid = gs.getGrid();
if( grid == null )
{
this.myStorage = gs;
this.myStorage.setGrid( this );
for( IGridCache gc : this.caches.values() )
for( final IGridCache gc : this.caches.values() )
{
gc.onJoin( this.myStorage );
}
@@ -170,17 +170,17 @@ public class Grid implements IGrid
this.myStorage.setGrid( this );
}
IGridStorage tmp = new GridStorage();
final IGridStorage tmp = new GridStorage();
if( !gs.hasDivided( this.myStorage ) )
{
gs.addDivided( this.myStorage );
for( IGridCache gc : ( (Grid) grid ).caches.values() )
for( final IGridCache gc : ( (Grid) grid ).caches.values() )
{
gc.onSplit( tmp );
}
for( IGridCache gc : this.caches.values() )
for( final IGridCache gc : this.caches.values() )
{
gc.onJoin( tmp );
}
@@ -199,9 +199,9 @@ public class Grid implements IGrid
// track node.
nodes.add( gridNode );
for( IGridCache cache : this.caches.values() )
for( final IGridCache cache : this.caches.values() )
{
IGridHost machine = gridNode.getMachine();
final IGridHost machine = gridNode.getMachine();
cache.addNode( gridNode, machine );
}
@@ -211,19 +211,19 @@ public class Grid implements IGrid
@Override
@SuppressWarnings( "unchecked" )
public <C extends IGridCache> C getCache( Class<? extends IGridCache> iface )
public <C extends IGridCache> C getCache( final Class<? extends IGridCache> iface )
{
return (C) this.caches.get( iface ).myCache;
}
@Override
public MENetworkEvent postEvent( MENetworkEvent ev )
public MENetworkEvent postEvent( final MENetworkEvent ev )
{
return this.eventBus.postEvent( this, ev );
}
@Override
public MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev )
public MENetworkEvent postEventTo( final IGridNode node, final MENetworkEvent ev )
{
return this.eventBus.postEventTo( this, (GridNode) node, ev );
}
@@ -231,15 +231,15 @@ public class Grid implements IGrid
@Override
public IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses()
{
Set<Class<? extends IGridHost>> machineKeys = this.machines.keySet();
final Set<Class<? extends IGridHost>> machineKeys = this.machines.keySet();
return new ReadOnlyCollection<Class<? extends IGridHost>>( machineKeys );
}
@Override
public IMachineSet getMachines( Class<? extends IGridHost> c )
public IMachineSet getMachines( final Class<? extends IGridHost> c )
{
MachineSet s = this.machines.get( c );
final MachineSet s = this.machines.get( c );
if( s == null )
{
return new MachineSet( c );
@@ -265,14 +265,14 @@ public class Grid implements IGrid
return this.pivot;
}
public void setPivot( GridNode pivot )
public void setPivot( final GridNode pivot )
{
this.pivot = pivot;
}
public void update()
{
for( IGridCache gc : this.caches.values() )
for( final IGridCache gc : this.caches.values() )
{
// are there any nodes left?
if( this.pivot != null )
@@ -284,15 +284,15 @@ public class Grid implements IGrid
public void saveState()
{
for( IGridCache c : this.caches.values() )
for( final IGridCache c : this.caches.values() )
{
c.populateGridStorage( this.myStorage );
}
}
public void setImportantFlag( int i, boolean publicHasPower )
public void setImportantFlag( final int i, final boolean publicHasPower )
{
int flag = 1 << i;
final int flag = 1 << i;
this.priority = ( this.priority & ~flag ) | ( publicHasPower ? flag : 0 );
}
}
+15 -15
View File
@@ -49,11 +49,11 @@ public class GridConnection implements IGridConnection, IPathItem
private AEPartLocation fromAtoB;
private GridNode sideB;
public GridConnection( IGridNode aNode, IGridNode bNode, AEPartLocation fromAtoB ) throws FailedConnection
public GridConnection( final IGridNode aNode, final IGridNode bNode, final AEPartLocation fromAtoB ) throws FailedConnection
{
GridNode a = (GridNode) aNode;
GridNode b = (GridNode) bNode;
final GridNode a = (GridNode) aNode;
final GridNode b = (GridNode) bNode;
if( Platform.securityCheck( a, b ) )
{
@@ -93,41 +93,41 @@ public class GridConnection implements IGridConnection, IPathItem
{
if( a.getMyGrid() == null )
{
GridPropagator gp = new GridPropagator( b.getInternalGrid() );
final GridPropagator gp = new GridPropagator( b.getInternalGrid() );
a.beginVisit( gp );
}
else if( b.getMyGrid() == null )
{
GridPropagator gp = new GridPropagator( a.getInternalGrid() );
final GridPropagator gp = new GridPropagator( a.getInternalGrid() );
b.beginVisit( gp );
}
else if( this.isNetworkABetter( a, b ) )
{
GridPropagator gp = new GridPropagator( a.getInternalGrid() );
final GridPropagator gp = new GridPropagator( a.getInternalGrid() );
b.beginVisit( gp );
}
else
{
GridPropagator gp = new GridPropagator( b.getInternalGrid() );
final GridPropagator gp = new GridPropagator( b.getInternalGrid() );
a.beginVisit( gp );
}
}
// a connection was destroyed RE-PATH!!
IPathingGrid p = this.sideA.getInternalGrid().getCache( IPathingGrid.class );
final IPathingGrid p = this.sideA.getInternalGrid().getCache( IPathingGrid.class );
p.repath();
this.sideA.addConnection( this );
this.sideB.addConnection( this );
}
private boolean isNetworkABetter( GridNode a, GridNode b )
private boolean isNetworkABetter( final GridNode a, final GridNode b )
{
return a.getMyGrid().getPriority() > b.getMyGrid().getPriority() || a.getMyGrid().size() > b.getMyGrid().size();
}
@Override
public IGridNode getOtherSide( IGridNode gridNode )
public IGridNode getOtherSide( final IGridNode gridNode )
{
if( gridNode == this.sideA )
{
@@ -142,7 +142,7 @@ public class GridConnection implements IGridConnection, IPathItem
}
@Override
public AEPartLocation getDirection( IGridNode side )
public AEPartLocation getDirection( final IGridNode side )
{
if( this.fromAtoB == AEPartLocation.INTERNAL )
{
@@ -163,7 +163,7 @@ public class GridConnection implements IGridConnection, IPathItem
public void destroy()
{
// a connection was destroyed RE-PATH!!
IPathingGrid p = this.sideA.getInternalGrid().getCache( IPathingGrid.class );
final IPathingGrid p = this.sideA.getInternalGrid().getCache( IPathingGrid.class );
p.repath();
this.sideA.removeConnection( this );
@@ -208,7 +208,7 @@ public class GridConnection implements IGridConnection, IPathItem
}
@Override
public void setControllerRoute( IPathItem fast, boolean zeroOut )
public void setControllerRoute( final IPathItem fast, final boolean zeroOut )
{
if( zeroOut )
{
@@ -217,7 +217,7 @@ public class GridConnection implements IGridConnection, IPathItem
if( this.sideB == fast )
{
GridNode tmp = this.sideA;
final GridNode tmp = this.sideA;
this.sideA = this.sideB;
this.sideB = tmp;
this.fromAtoB = this.fromAtoB.getOpposite();
@@ -237,7 +237,7 @@ public class GridConnection implements IGridConnection, IPathItem
}
@Override
public void incrementChannelCount( int usedChannels )
public void incrementChannelCount( final int usedChannels )
{
this.channelData += usedChannels;
}
+1 -1
View File
@@ -24,7 +24,7 @@ public class GridException extends RuntimeException
private static final long serialVersionUID = -8110077032108243076L;
public GridException( String s )
public GridException( final String s )
{
super( s );
+67 -67
View File
@@ -75,7 +75,7 @@ public class GridNode implements IGridNode, IPathItem
private int usedChannels = 0;
private int lastUsedChannels = 0;
public GridNode( IGridBlock what )
public GridNode( final IGridBlock what )
{
this.gridProxy = what;
}
@@ -100,7 +100,7 @@ public class GridNode implements IGridNode, IPathItem
return this.getMachine().getClass();
}
public void addConnection( IGridConnection gridConnection )
public void addConnection( final IGridConnection gridConnection )
{
this.connections.add( gridConnection );
if( gridConnection.hasDirection() )
@@ -113,7 +113,7 @@ public class GridNode implements IGridNode, IPathItem
Collections.sort( this.connections, new ConnectionComparator( gn ) );
}
public void removeConnection( IGridConnection gridConnection )
public void removeConnection( final IGridConnection gridConnection )
{
this.connections.remove( gridConnection );
if( gridConnection.hasDirection() )
@@ -122,9 +122,9 @@ public class GridNode implements IGridNode, IPathItem
}
}
public boolean hasConnection( IGridNode otherSide )
public boolean hasConnection( final IGridNode otherSide )
{
for( IGridConnection gc : this.connections )
for( final IGridConnection gc : this.connections )
{
if( gc.a() == otherSide || gc.b() == otherSide )
{
@@ -136,11 +136,11 @@ public class GridNode implements IGridNode, IPathItem
public void validateGrid()
{
GridSplitDetector gsd = new GridSplitDetector( this.getInternalGrid().getPivot() );
final GridSplitDetector gsd = new GridSplitDetector( this.getInternalGrid().getPivot() );
this.beginVisit( gsd );
if( !gsd.pivotFound )
{
IGridVisitor gp = new GridPropagator( new Grid( this ) );
final IGridVisitor gp = new GridPropagator( new Grid( this ) );
this.beginVisit( gp );
}
}
@@ -156,9 +156,9 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void beginVisit( IGridVisitor g )
public void beginVisit( final IGridVisitor g )
{
Object tracker = new Object();
final Object tracker = new Object();
LinkedList<GridNode> nextRun = new LinkedList<GridNode>();
nextRun.add( this );
@@ -167,8 +167,8 @@ public class GridNode implements IGridNode, IPathItem
if( g instanceof IGridConnectionVisitor )
{
LinkedList<IGridConnection> nextConn = new LinkedList<IGridConnection>();
IGridConnectionVisitor gcv = (IGridConnectionVisitor) g;
final LinkedList<IGridConnection> nextConn = new LinkedList<IGridConnection>();
final IGridConnectionVisitor gcv = (IGridConnectionVisitor) g;
while( !nextRun.isEmpty() )
{
@@ -177,10 +177,10 @@ public class GridNode implements IGridNode, IPathItem
gcv.visitConnection( nextConn.poll() );
}
Iterable<GridNode> thisRun = nextRun;
final Iterable<GridNode> thisRun = nextRun;
nextRun = new LinkedList<GridNode>();
for( GridNode n : thisRun )
for( final GridNode n : thisRun )
{
n.visitorConnection( tracker, g, nextRun, nextConn );
}
@@ -190,10 +190,10 @@ public class GridNode implements IGridNode, IPathItem
{
while( !nextRun.isEmpty() )
{
Iterable<GridNode> thisRun = nextRun;
final Iterable<GridNode> thisRun = nextRun;
nextRun = new LinkedList<GridNode>();
for( GridNode n : thisRun )
for( final GridNode n : thisRun )
{
n.visitorNode( tracker, g, nextRun );
}
@@ -204,13 +204,13 @@ public class GridNode implements IGridNode, IPathItem
@Override
public void updateState()
{
EnumSet<GridFlags> set = this.gridProxy.getFlags();
final EnumSet<GridFlags> set = this.gridProxy.getFlags();
this.compressedData = set.contains( GridFlags.CANNOT_CARRY ) ? 0 : ( set.contains( GridFlags.DENSE_CAPACITY ) ? 2 : 1 );
this.compressedData |= ( this.gridProxy.getGridColor().ordinal() << 3 );
for( EnumFacing dir : this.gridProxy.getConnectableSides() )
for( final EnumFacing dir : this.gridProxy.getConnectableSides() )
{
this.compressedData |= ( 1 << ( dir.ordinal() + 8 ) );
}
@@ -231,7 +231,7 @@ public class GridNode implements IGridNode, IPathItem
return this.myGrid;
}
public void setGrid( Grid grid )
public void setGrid( final Grid grid )
{
if( this.myGrid == grid )
{
@@ -246,7 +246,7 @@ public class GridNode implements IGridNode, IPathItem
{
this.myGrid.saveState();
for( IGridCache c : grid.getCaches().values() )
for( final IGridCache c : grid.getCaches().values() )
{
c.onJoin( this.myGrid.getMyStorage() );
}
@@ -268,8 +268,8 @@ public class GridNode implements IGridNode, IPathItem
this.setGridStorage( null );
}
IGridConnection c = this.connections.listIterator().next();
GridNode otherSide = (GridNode) c.getOtherSide( this );
final IGridConnection c = this.connections.listIterator().next();
final GridNode otherSide = (GridNode) c.getOtherSide( this );
otherSide.getInternalGrid().setPivot( otherSide );
c.destroy();
}
@@ -289,8 +289,8 @@ public class GridNode implements IGridNode, IPathItem
@Override
public EnumSet<AEPartLocation> getConnectedSides()
{
EnumSet<AEPartLocation> set = EnumSet.noneOf( AEPartLocation.class );
for( IGridConnection gc : this.connections )
final EnumSet<AEPartLocation> set = EnumSet.noneOf( AEPartLocation.class );
for( final IGridConnection gc : this.connections )
{
set.add( gc.getDirection( this ) );
}
@@ -312,22 +312,22 @@ public class GridNode implements IGridNode, IPathItem
@Override
public boolean isActive()
{
IGrid g = this.getGrid();
final IGrid g = this.getGrid();
if( g != null )
{
IPathingGrid pg = g.getCache( IPathingGrid.class );
IEnergyGrid eg = g.getCache( IEnergyGrid.class );
final IPathingGrid pg = g.getCache( IPathingGrid.class );
final IEnergyGrid eg = g.getCache( IEnergyGrid.class );
return this.meetsChannelRequirements() && eg.isNetworkPowered() && !pg.isNetworkBooting();
}
return false;
}
@Override
public void loadFromNBT( String name, NBTTagCompound nodeData )
public void loadFromNBT( final String name, final NBTTagCompound nodeData )
{
if( this.myGrid == null )
{
NBTTagCompound node = nodeData.getCompoundTag( name );
final NBTTagCompound node = nodeData.getCompoundTag( name );
this.playerID = node.getInteger( "p" );
this.lastSecurityKey = node.getLong( "k" );
@@ -342,11 +342,11 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void saveToNBT( String name, NBTTagCompound nodeData )
public void saveToNBT( final String name, final NBTTagCompound nodeData )
{
if( this.myStorage != null )
{
NBTTagCompound node = new NBTTagCompound();
final NBTTagCompound node = new NBTTagCompound();
node.setInteger( "p", this.playerID );
node.setLong( "k", this.lastSecurityKey );
@@ -367,7 +367,7 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public boolean hasFlag( GridFlags flag )
public boolean hasFlag( final GridFlags flag )
{
return this.gridProxy.getFlags().contains( flag );
}
@@ -379,7 +379,7 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void setPlayerID( int playerID )
public void setPlayerID( final int playerID )
{
if( playerID >= 0 )
{
@@ -399,25 +399,25 @@ public class GridNode implements IGridNode, IPathItem
return;
}
EnumSet<AEPartLocation> newSecurityConnections = EnumSet.noneOf( AEPartLocation.class );
final EnumSet<AEPartLocation> newSecurityConnections = EnumSet.noneOf( AEPartLocation.class );
DimensionalCoord dc = this.gridProxy.getLocation();
for( AEPartLocation f : AEPartLocation.SIDE_LOCATIONS )
final DimensionalCoord dc = this.gridProxy.getLocation();
for( final AEPartLocation f : AEPartLocation.SIDE_LOCATIONS )
{
IGridHost te = this.findGridHost( dc.getWorld(), dc.x + f.xOffset, dc.y + f.yOffset, dc.z + f.zOffset );
final IGridHost te = this.findGridHost( dc.getWorld(), dc.x + f.xOffset, dc.y + f.yOffset, dc.z + f.zOffset );
if( te != null )
{
GridNode node = (GridNode) te.getGridNode( f.getOpposite() );
final GridNode node = (GridNode) te.getGridNode( f.getOpposite() );
if( node == null )
{
continue;
}
boolean isValidConnection = this.canConnect( node, f ) && node.canConnect( this, f.getOpposite() );
final boolean isValidConnection = this.canConnect( node, f ) && node.canConnect( this, f.getOpposite() );
IGridConnection con = null; // find the connection for this
// direction..
for( IGridConnection c : this.getConnections() )
for( final IGridConnection c : this.getConnections() )
{
if( c.getDirection( this ) == f )
{
@@ -428,7 +428,7 @@ public class GridNode implements IGridNode, IPathItem
if( con != null )
{
IGridNode os = con.getOtherSide( this );
final IGridNode os = con.getOtherSide( this );
if( os == node )
{
// if this connection is no longer valid, destroy it.
@@ -456,7 +456,7 @@ public class GridNode implements IGridNode, IPathItem
{
new GridConnection( node, this, f.getOpposite() );
}
catch( FailedConnection e )
catch( final FailedConnection e )
{
TickHandler.INSTANCE.addCallable( node.getWorld(), new MachineSecurityBreak( this ) );
@@ -467,12 +467,12 @@ public class GridNode implements IGridNode, IPathItem
}
}
for( AEPartLocation f : newSecurityConnections )
for( final AEPartLocation f : newSecurityConnections )
{
IGridHost te = this.findGridHost( dc.getWorld(), dc.x + f.xOffset, dc.y + f.yOffset, dc.z + f.zOffset );
final IGridHost te = this.findGridHost( dc.getWorld(), dc.x + f.xOffset, dc.y + f.yOffset, dc.z + f.zOffset );
if( te != null )
{
GridNode node = (GridNode) te.getGridNode( f.getOpposite() );
final GridNode node = (GridNode) te.getGridNode( f.getOpposite() );
if( node == null )
{
continue;
@@ -483,7 +483,7 @@ public class GridNode implements IGridNode, IPathItem
{
new GridConnection( node, this, f.getOpposite() );
}
catch( FailedConnection e )
catch( final FailedConnection e )
{
TickHandler.INSTANCE.addCallable( node.getWorld(), new MachineSecurityBreak( this ) );
@@ -493,12 +493,12 @@ public class GridNode implements IGridNode, IPathItem
}
}
private IGridHost findGridHost( World world, int x, int y, int z )
private IGridHost findGridHost( final World world, final int x, final int y, final int z )
{
BlockPos pos = new BlockPos(x,y,z);
final BlockPos pos = new BlockPos(x,y,z);
if( world.isBlockLoaded( pos ) )
{
TileEntity te = world.getTileEntity( pos );
final TileEntity te = world.getTileEntity( pos );
if( te instanceof IGridHost )
{
return (IGridHost) te;
@@ -507,7 +507,7 @@ public class GridNode implements IGridNode, IPathItem
return null;
}
public boolean canConnect( GridNode from, AEPartLocation dir )
public boolean canConnect( final GridNode from, final AEPartLocation dir )
{
if( !this.isValidDirection( dir ) )
{
@@ -522,7 +522,7 @@ public class GridNode implements IGridNode, IPathItem
return true;
}
private boolean isValidDirection( AEPartLocation dir )
private boolean isValidDirection( final AEPartLocation dir )
{
return ( this.compressedData & ( 1 << ( 8 + dir.ordinal() ) ) ) > 0;
}
@@ -532,14 +532,14 @@ public class GridNode implements IGridNode, IPathItem
return AEColor.values()[( this.compressedData >> 3 ) & 0x1F];
}
private void visitorConnection( Object tracker, IGridVisitor g, Deque<GridNode> nextRun, Deque<IGridConnection> nextConnections )
private void visitorConnection( final Object tracker, final IGridVisitor g, final Deque<GridNode> nextRun, final Deque<IGridConnection> nextConnections )
{
if( g.visitNode( this ) )
{
for( IGridConnection gc : this.getConnections() )
for( final IGridConnection gc : this.getConnections() )
{
GridNode gn = (GridNode) gc.getOtherSide( this );
GridConnection gcc = (GridConnection) gc;
final GridNode gn = (GridNode) gc.getOtherSide( this );
final GridConnection gcc = (GridConnection) gc;
if( gcc.visitorIterationNumber != tracker )
{
@@ -559,13 +559,13 @@ public class GridNode implements IGridNode, IPathItem
}
}
private void visitorNode( Object tracker, IGridVisitor g, Deque<GridNode> nextRun )
private void visitorNode( final Object tracker, final IGridVisitor g, final Deque<GridNode> nextRun )
{
if( g.visitNode( this ) )
{
for( IGridConnection gc : this.getConnections() )
for( final IGridConnection gc : this.getConnections() )
{
GridNode gn = (GridNode) gc.getOtherSide( this );
final GridNode gn = (GridNode) gc.getOtherSide( this );
if( tracker == gn.visitorIterationNumber )
{
@@ -584,7 +584,7 @@ public class GridNode implements IGridNode, IPathItem
return this.myStorage;
}
public void setGridStorage( GridStorage s )
public void setGridStorage( final GridStorage s )
{
this.myStorage = s;
this.usedChannels = 0;
@@ -603,14 +603,14 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void setControllerRoute( IPathItem fast, boolean zeroOut )
public void setControllerRoute( final IPathItem fast, final boolean zeroOut )
{
if( zeroOut )
{
this.usedChannels = 0;
}
int idx = this.connections.indexOf( fast );
final int idx = this.connections.indexOf( fast );
if( idx > 0 )
{
this.connections.remove( fast );
@@ -636,7 +636,7 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void incrementChannelCount( int usedChannels )
public void incrementChannelCount( final int usedChannels )
{
this.usedChannels += usedChannels;
}
@@ -675,13 +675,13 @@ public class GridNode implements IGridNode, IPathItem
{
private final GridNode node;
public MachineSecurityBreak( GridNode node )
public MachineSecurityBreak( final GridNode node )
{
this.node = node;
}
@Override
public Void call(World world) throws Exception
public Void call( final World world) throws Exception
{
this.node.getMachine().securityBreak();
@@ -693,16 +693,16 @@ public class GridNode implements IGridNode, IPathItem
{
private final IGridNode gn;
public ConnectionComparator( IGridNode gn )
public ConnectionComparator( final IGridNode gn )
{
this.gn = gn;
}
@Override
public int compare( IGridConnection o1, IGridConnection o2 )
public int compare( final IGridConnection o1, final IGridConnection o2 )
{
boolean preferredA = o1.getOtherSide( this.gn ).hasFlag( GridFlags.PREFERRED );
boolean preferredB = o2.getOtherSide( this.gn ).hasFlag( GridFlags.PREFERRED );
final boolean preferredA = o1.getOtherSide( this.gn ).hasFlag( GridFlags.PREFERRED );
final boolean preferredB = o2.getOtherSide( this.gn ).hasFlag( GridFlags.PREFERRED );
return preferredA == preferredB ? 0 : ( preferredA ? -1 : 1 );
}
@@ -32,7 +32,7 @@ public class GridNodeCollection implements IReadOnlyCollection<IGridNode>
{
private final Map<Class<? extends IGridHost>, MachineSet> machines;
public GridNodeCollection( Map<Class<? extends IGridHost>, MachineSet> machines )
public GridNodeCollection( final Map<Class<? extends IGridHost>, MachineSet> machines )
{
this.machines = machines;
}
@@ -48,7 +48,7 @@ public class GridNodeCollection implements IReadOnlyCollection<IGridNode>
{
int size = 0;
for( Set<IGridNode> o : this.machines.values() )
for( final Set<IGridNode> o : this.machines.values() )
{
size += o.size();
}
@@ -59,7 +59,7 @@ public class GridNodeCollection implements IReadOnlyCollection<IGridNode>
@Override
public boolean isEmpty()
{
for( Set<IGridNode> o : this.machines.values() )
for( final Set<IGridNode> o : this.machines.values() )
{
if( !o.isEmpty() )
{
@@ -71,17 +71,17 @@ public class GridNodeCollection implements IReadOnlyCollection<IGridNode>
}
@Override
public boolean contains( Object maybeGridNode )
public boolean contains( final Object maybeGridNode )
{
final boolean doesContainNode;
if( maybeGridNode instanceof IGridNode )
{
final IGridNode node = (IGridNode) maybeGridNode;
IGridHost machine = node.getMachine();
Class<? extends IGridHost> machineClass = machine.getClass();
final IGridHost machine = node.getMachine();
final Class<? extends IGridHost> machineClass = machine.getClass();
MachineSet machineSet = this.machines.get( machineClass );
final MachineSet machineSet = this.machines.get( machineClass );
doesContainNode = machineSet != null && machineSet.contains( maybeGridNode );
}
@@ -37,7 +37,7 @@ public class GridNodeIterator implements Iterator<IGridNode>
private final Iterator<MachineSet> outerIterator;
private Iterator<IGridNode> innerIterator;
public GridNodeIterator( Map<Class<? extends IGridHost>, MachineSet> machines )
public GridNodeIterator( final Map<Class<? extends IGridHost>, MachineSet> machines )
{
this.outerIterator = machines.values().iterator();
this.innerHasNext();
+3 -3
View File
@@ -27,15 +27,15 @@ public class GridPropagator implements IGridVisitor
{
private final Grid g;
public GridPropagator( Grid g )
public GridPropagator( final Grid g )
{
this.g = g;
}
@Override
public boolean visitNode( IGridNode n )
public boolean visitNode( final IGridNode n )
{
GridNode gn = (GridNode) n;
final GridNode gn = (GridNode) n;
if( gn.getMyGrid() != this.g || this.g.getPivot() == n )
{
gn.setGrid( this.g );
@@ -29,13 +29,13 @@ class GridSplitDetector implements IGridVisitor
final IGridNode pivot;
boolean pivotFound;
public GridSplitDetector( IGridNode pivot )
public GridSplitDetector( final IGridNode pivot )
{
this.pivot = pivot;
}
@Override
public boolean visitNode( IGridNode n )
public boolean visitNode( final IGridNode n )
{
if( n == this.pivot )
{
+10 -10
View File
@@ -50,7 +50,7 @@ public class GridStorage implements IGridStorage
* @param id ID of grid storage
* @param gss grid storage search
*/
public GridStorage( long id, GridStorageSearch gss )
public GridStorage( final long id, final GridStorageSearch gss )
{
this.myID = id;
this.mySearchEntry = gss;
@@ -64,7 +64,7 @@ public class GridStorage implements IGridStorage
* @param id ID of grid storage
* @param gss grid storage search
*/
public GridStorage( String input, long id, GridStorageSearch gss )
public GridStorage( final String input, final long id, final GridStorageSearch gss )
{
this.myID = id;
this.mySearchEntry = gss;
@@ -72,10 +72,10 @@ public class GridStorage implements IGridStorage
try
{
byte[] byteData = javax.xml.bind.DatatypeConverter.parseBase64Binary( input );
final byte[] byteData = javax.xml.bind.DatatypeConverter.parseBase64Binary( input );
myTag = CompressedStreamTools.readCompressed( new ByteArrayInputStream( byteData ) );
}
catch( Throwable t )
catch( final Throwable t )
{
myTag = new NBTTagCompound();
}
@@ -97,7 +97,7 @@ public class GridStorage implements IGridStorage
{
this.isDirty = false;
Grid currentGrid = (Grid) this.getGrid();
final Grid currentGrid = (Grid) this.getGrid();
if( currentGrid != null )
{
currentGrid.saveState();
@@ -105,11 +105,11 @@ public class GridStorage implements IGridStorage
try
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
final ByteArrayOutputStream out = new ByteArrayOutputStream();
CompressedStreamTools.writeCompressed( this.data, out );
return javax.xml.bind.DatatypeConverter.printBase64Binary( out.toByteArray() );
}
catch( IOException e )
catch( final IOException e )
{
AELog.error( e );
}
@@ -122,7 +122,7 @@ public class GridStorage implements IGridStorage
return this.internalGrid == null ? null : this.internalGrid.get();
}
public void setGrid( Grid grid )
public void setGrid( final Grid grid )
{
this.internalGrid = new WeakReference<IGrid>( grid );
}
@@ -144,12 +144,12 @@ public class GridStorage implements IGridStorage
this.isDirty = true;
}
public void addDivided( GridStorage gs )
public void addDivided( final GridStorage gs )
{
this.divided.put( gs, true );
}
public boolean hasDivided( GridStorage myStorage )
public boolean hasDivided( final GridStorage myStorage )
{
return this.divided.containsKey( myStorage );
}
@@ -33,7 +33,7 @@ public class GridStorageSearch
*
* @param id ID of grid storage search
*/
public GridStorageSearch( long id )
public GridStorageSearch( final long id )
{
this.id = id;
}
@@ -45,7 +45,7 @@ public class GridStorageSearch
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
if( obj == null )
{
@@ -56,7 +56,7 @@ public class GridStorageSearch
return false;
}
GridStorageSearch other = (GridStorageSearch) obj;
final GridStorageSearch other = (GridStorageSearch) obj;
if( this.id == other.id )
{
return true;
+1 -1
View File
@@ -33,7 +33,7 @@ public class MachineSet extends HashSet<IGridNode> implements IMachineSet
private final Class<? extends IGridHost> machine;
MachineSet( Class<? extends IGridHost> m )
MachineSet( final Class<? extends IGridHost> m )
{
this.machine = m;
}
+22 -22
View File
@@ -39,7 +39,7 @@ public class NetworkEventBus
private static final Collection<Class> READ_CLASSES = new HashSet<Class>();
private static final Map<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>> EVENTS = new HashMap<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>>();
public void readClass( Class listAs, Class c )
public void readClass( final Class listAs, final Class c )
{
if( READ_CLASSES.contains( c ) )
{
@@ -49,12 +49,12 @@ public class NetworkEventBus
try
{
for( Method m : c.getMethods() )
for( final Method m : c.getMethods() )
{
MENetworkEventSubscribe s = m.getAnnotation( MENetworkEventSubscribe.class );
final MENetworkEventSubscribe s = m.getAnnotation( MENetworkEventSubscribe.class );
if( s != null )
{
Class[] types = m.getParameterTypes();
final Class[] types = m.getParameterTypes();
if( types.length == 1 )
{
if( MENetworkEvent.class.isAssignableFrom( types[0] ) )
@@ -88,32 +88,32 @@ public class NetworkEventBus
}
}
}
catch( Throwable t )
catch( final Throwable t )
{
throw new IllegalStateException( "Error while adding " + c.getName() + " to event bus", t );
}
}
public MENetworkEvent postEvent( Grid g, MENetworkEvent e )
public MENetworkEvent postEvent( final Grid g, final MENetworkEvent e )
{
Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
final Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
int x = 0;
try
{
if( subscribers != null )
{
for( Entry<Class, MENetworkEventInfo> subscriber : subscribers.entrySet() )
for( final Entry<Class, MENetworkEventInfo> subscriber : subscribers.entrySet() )
{
MENetworkEventInfo target = subscriber.getValue();
GridCacheWrapper cache = g.getCaches().get( subscriber.getKey() );
final MENetworkEventInfo target = subscriber.getValue();
final GridCacheWrapper cache = g.getCaches().get( subscriber.getKey() );
if( cache != null )
{
x++;
target.invoke( cache.myCache, e );
}
for( IGridNode obj : g.getMachines( subscriber.getKey() ) )
for( final IGridNode obj : g.getMachines( subscriber.getKey() ) )
{
x++;
target.invoke( obj.getMachine(), e );
@@ -121,7 +121,7 @@ public class NetworkEventBus
}
}
}
catch( NetworkEventDone done )
catch( final NetworkEventDone done )
{
// Early out.
}
@@ -130,16 +130,16 @@ public class NetworkEventBus
return e;
}
public MENetworkEvent postEventTo( Grid grid, GridNode node, MENetworkEvent e )
public MENetworkEvent postEventTo( final Grid grid, final GridNode node, final MENetworkEvent e )
{
Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
final Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
int x = 0;
try
{
if( subscribers != null )
{
MENetworkEventInfo target = subscribers.get( node.getMachineClass() );
final MENetworkEventInfo target = subscribers.get( node.getMachineClass() );
if( target != null )
{
x++;
@@ -147,7 +147,7 @@ public class NetworkEventBus
}
}
}
catch( NetworkEventDone done )
catch( final NetworkEventDone done )
{
// Early out.
}
@@ -170,20 +170,20 @@ public class NetworkEventBus
public final Method objMethod;
public final Class objEvent;
public EventMethod( Class Event, Class ObjClass, Method ObjMethod )
public EventMethod( final Class Event, final Class ObjClass, final Method ObjMethod )
{
this.objClass = ObjClass;
this.objMethod = ObjMethod;
this.objEvent = Event;
}
public void invoke( Object obj, MENetworkEvent e ) throws NetworkEventDone
public void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone
{
try
{
this.objMethod.invoke( obj, e );
}
catch( Throwable e1 )
catch( final Throwable e1 )
{
AELog.severe( "[AppEng] Network Event caused exception:" );
AELog.severe( "Offending Class: " + obj.getClass().getName() );
@@ -205,14 +205,14 @@ public class NetworkEventBus
private final List<EventMethod> methods = new ArrayList<EventMethod>();
public void Add( Class Event, Class ObjClass, Method ObjMethod )
public void Add( final Class Event, final Class ObjClass, final Method ObjMethod )
{
this.methods.add( new EventMethod( Event, ObjClass, ObjMethod ) );
}
public void invoke( Object obj, MENetworkEvent e ) throws NetworkEventDone
public void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone
{
for( EventMethod em : this.methods )
for( final EventMethod em : this.methods )
{
em.invoke( obj, e );
}
+9 -9
View File
@@ -43,7 +43,7 @@ public class NetworkList implements Collection<Grid>
}
@Override
public boolean contains( Object o )
public boolean contains( final Object o )
{
return this.networks.contains( o );
}
@@ -61,47 +61,47 @@ public class NetworkList implements Collection<Grid>
}
@Override
public <T> T[] toArray( T[] a )
public <T> T[] toArray( final T[] a )
{
return this.networks.toArray( a );
}
@Override
public boolean add( Grid e )
public boolean add( final Grid e )
{
this.copy();
return this.networks.add( e );
}
@Override
public boolean remove( Object o )
public boolean remove( final Object o )
{
this.copy();
return this.networks.remove( o );
}
@Override
public boolean containsAll( Collection<?> c )
public boolean containsAll( final Collection<?> c )
{
return this.networks.containsAll( c );
}
@Override
public boolean addAll( Collection<? extends Grid> c )
public boolean addAll( final Collection<? extends Grid> c )
{
this.copy();
return this.networks.addAll( c );
}
@Override
public boolean removeAll( Collection<?> c )
public boolean removeAll( final Collection<?> c )
{
this.copy();
return this.networks.removeAll( c );
}
@Override
public boolean retainAll( Collection<?> c )
public boolean retainAll( final Collection<?> c )
{
this.copy();
return this.networks.retainAll( c );
@@ -115,7 +115,7 @@ public class NetworkList implements Collection<Grid>
private void copy()
{
List<Grid> old = this.networks;
final List<Grid> old = this.networks;
this.networks = new LinkedList<Grid>();
this.networks.addAll( old );
}
+59 -59
View File
@@ -92,7 +92,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
static final Comparator<ICraftingPatternDetails> COMPARATOR = new Comparator<ICraftingPatternDetails>()
{
@Override
public int compare( ICraftingPatternDetails firstDetail, ICraftingPatternDetails nextDetail )
public int compare( final ICraftingPatternDetails firstDetail, final ICraftingPatternDetails nextDetail )
{
return nextDetail.getPriority() - firstDetail.getPriority();
}
@@ -100,11 +100,11 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
static
{
ThreadFactory factory = new ThreadFactory()
final ThreadFactory factory = new ThreadFactory()
{
@Override
public Thread newThread( Runnable ar )
public Thread newThread( final Runnable ar )
{
return new Thread( ar, "AE Crafting Calculator" );
}
@@ -127,13 +127,13 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
private IEnergyGrid energyGrid;
private boolean updateList = false;
public CraftingGridCache( IGrid grid )
public CraftingGridCache( final IGrid grid )
{
this.grid = grid;
}
@MENetworkEventSubscribe
public void afterCacheConstruction( MENetworkPostCacheConstruction cacheConstruction )
public void afterCacheConstruction( final MENetworkPostCacheConstruction cacheConstruction )
{
this.storageGrid = this.grid.getCache( IStorageGrid.class );
this.energyGrid = this.grid.getCache( IEnergyGrid.class );
@@ -150,7 +150,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
this.updateCPUClusters();
}
Iterator<CraftingLinkNexus> craftingLinkIterator = this.craftingLinks.values().iterator();
final Iterator<CraftingLinkNexus> craftingLinkIterator = this.craftingLinks.values().iterator();
while( craftingLinkIterator.hasNext() )
{
if( craftingLinkIterator.next().isDead( this.grid, this ) )
@@ -159,18 +159,18 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
}
for( CraftingCPUCluster cpu : this.craftingCPUClusters )
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
{
cpu.updateCraftingLogic( this.grid, this.energyGrid, this );
}
}
@Override
public void removeNode( IGridNode gridNode, IGridHost machine )
public void removeNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof ICraftingWatcherHost )
{
ICraftingWatcher craftingWatcher = this.craftingWatchers.get( machine );
final ICraftingWatcher craftingWatcher = this.craftingWatchers.get( machine );
if( craftingWatcher != null )
{
craftingWatcher.clear();
@@ -180,7 +180,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if( machine instanceof ICraftingRequester )
{
for( CraftingLinkNexus link : this.craftingLinks.values() )
for( final CraftingLinkNexus link : this.craftingLinks.values() )
{
if( link.isMachine( machine ) )
{
@@ -202,19 +202,19 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public void addNode( IGridNode gridNode, IGridHost machine )
public void addNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof ICraftingWatcherHost )
{
ICraftingWatcherHost watcherHost = (ICraftingWatcherHost) machine;
CraftingWatcher watcher = new CraftingWatcher( this, watcherHost );
final ICraftingWatcherHost watcherHost = (ICraftingWatcherHost) machine;
final CraftingWatcher watcher = new CraftingWatcher( this, watcherHost );
this.craftingWatchers.put( gridNode, watcher );
watcherHost.updateWatcher( watcher );
}
if( machine instanceof ICraftingRequester )
{
for( ICraftingLink link : ( (ICraftingRequester) machine ).getRequestedJobs() )
for( final ICraftingLink link : ( (ICraftingRequester) machine ).getRequestedJobs() )
{
if( link instanceof CraftingLink )
{
@@ -236,25 +236,25 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public void onSplit( IGridStorage destinationStorage )
public void onSplit( final IGridStorage destinationStorage )
{ // nothing!
}
@Override
public void onJoin( IGridStorage sourceStorage )
public void onJoin( final IGridStorage sourceStorage )
{
// nothing!
}
@Override
public void populateGridStorage( IGridStorage destinationStorage )
public void populateGridStorage( final IGridStorage destinationStorage )
{
// nothing!
}
private void updatePatterns()
{
Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> oldItems = this.craftableItems;
final Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> oldItems = this.craftableItems;
// erase list.
this.craftingMethods.clear();
@@ -265,15 +265,15 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
this.storageGrid.postAlterationOfStoredItems( StorageChannel.ITEMS, oldItems.keySet(), new BaseActionSource() );
// re-create list..
for( ICraftingProvider provider : this.craftingProviders )
for( final ICraftingProvider provider : this.craftingProviders )
{
provider.provideCrafting( this );
}
Map<IAEItemStack, Set<ICraftingPatternDetails>> tmpCraft = new HashMap<IAEItemStack, Set<ICraftingPatternDetails>>();
final Map<IAEItemStack, Set<ICraftingPatternDetails>> tmpCraft = new HashMap<IAEItemStack, Set<ICraftingPatternDetails>>();
// new craftables!
for( ICraftingPatternDetails details : this.craftingMethods.keySet() )
for( final ICraftingPatternDetails details : this.craftingMethods.keySet() )
{
for( IAEItemStack out : details.getOutputs() )
{
@@ -293,7 +293,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
// make them immutable
for( Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet() )
for( final Entry<IAEItemStack, Set<ICraftingPatternDetails>> e : tmpCraft.entrySet() )
{
this.craftableItems.put( e.getKey(), ImmutableList.copyOf( e.getValue() ) );
}
@@ -305,10 +305,10 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
{
this.craftingCPUClusters.clear();
for( IGridNode cst : this.grid.getMachines( TileCraftingStorageTile.class ) )
for( final IGridNode cst : this.grid.getMachines( TileCraftingStorageTile.class ) )
{
TileCraftingStorageTile tile = (TileCraftingStorageTile) cst.getMachine();
CraftingCPUCluster cluster = (CraftingCPUCluster) tile.getCluster();
final TileCraftingStorageTile tile = (TileCraftingStorageTile) cst.getMachine();
final CraftingCPUCluster cluster = (CraftingCPUCluster) tile.getCluster();
if( cluster != null )
{
this.craftingCPUClusters.add( cluster );
@@ -321,7 +321,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
}
public void addLink( CraftingLink link )
public void addLink( final CraftingLink link )
{
if( link.isStandalone() )
{
@@ -338,19 +338,19 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@MENetworkEventSubscribe
public void updateCPUClusters( MENetworkCraftingCpuChange c )
public void updateCPUClusters( final MENetworkCraftingCpuChange c )
{
this.updateList = true;
}
@MENetworkEventSubscribe
public void updateCPUClusters( MENetworkCraftingPatternChange c )
public void updateCPUClusters( final MENetworkCraftingPatternChange c )
{
this.updatePatterns();
}
@Override
public void addCraftingOption( ICraftingMedium medium, ICraftingPatternDetails api )
public void addCraftingOption( final ICraftingMedium medium, final ICraftingPatternDetails api )
{
List<ICraftingMedium> details = this.craftingMethods.get( api );
if( details == null )
@@ -366,15 +366,15 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public void setEmitable( IAEItemStack someItem )
public void setEmitable( final IAEItemStack someItem )
{
this.emitableItems.add( someItem.copy() );
}
@Override
public List<IMEInventoryHandler> getCellArray( StorageChannel channel )
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
List<IMEInventoryHandler> list = new ArrayList<IMEInventoryHandler>( 1 );
final List<IMEInventoryHandler> list = new ArrayList<IMEInventoryHandler>( 1 );
if( channel == StorageChannel.ITEMS )
{
@@ -397,15 +397,15 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public boolean isPrioritized( IAEStack input )
public boolean isPrioritized( final IAEStack input )
{
return true;
}
@Override
public boolean canAccept( IAEStack input )
public boolean canAccept( final IAEStack input )
{
for( CraftingCPUCluster cpu : this.craftingCPUClusters )
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
{
if( cpu.canAccept( input ) )
{
@@ -423,15 +423,15 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 1;
}
@Override
public IAEStack injectItems( IAEStack input, Actionable type, BaseActionSource src )
public IAEStack injectItems( IAEStack input, final Actionable type, final BaseActionSource src )
{
for( CraftingCPUCluster cpu : this.craftingCPUClusters )
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
{
input = cpu.injectItems( input, type, src );
}
@@ -440,21 +440,21 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public IAEStack extractItems( IAEStack request, Actionable mode, BaseActionSource src )
public IAEStack extractItems( final IAEStack request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<IAEStack> getAvailableItems( IItemList<IAEStack> out )
public IItemList<IAEStack> getAvailableItems( final IItemList<IAEStack> out )
{
// add craftable items!
for( IAEItemStack stack : this.craftableItems.keySet() )
for( final IAEItemStack stack : this.craftableItems.keySet() )
{
out.addCrafting( stack );
}
for( IAEItemStack st : this.emitableItems )
for( final IAEItemStack st : this.emitableItems )
{
out.addCrafting( st );
}
@@ -469,15 +469,15 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public ImmutableCollection<ICraftingPatternDetails> getCraftingFor( IAEItemStack whatToCraft, ICraftingPatternDetails details, int slotIndex, World world )
public ImmutableCollection<ICraftingPatternDetails> getCraftingFor( final IAEItemStack whatToCraft, final ICraftingPatternDetails details, final int slotIndex, final World world )
{
ImmutableList<ICraftingPatternDetails> res = this.craftableItems.get( whatToCraft );
final ImmutableList<ICraftingPatternDetails> res = this.craftableItems.get( whatToCraft );
if( res == null )
{
if( details != null && details.isCraftable() )
{
for( IAEItemStack ais : this.craftableItems.keySet() )
for( final IAEItemStack ais : this.craftableItems.keySet() )
{
if( ais.getItem() == whatToCraft.getItem() && ( !ais.getItem().getHasSubtypes() || ais.getItemDamage() == whatToCraft.getItemDamage() ) )
{
@@ -496,20 +496,20 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack slotItem, ICraftingCallback cb )
public Future<ICraftingJob> beginCraftingJob( final World world, final IGrid grid, final BaseActionSource actionSrc, final IAEItemStack slotItem, final ICraftingCallback cb )
{
if( world == null || grid == null || actionSrc == null || slotItem == null )
{
throw new IllegalArgumentException( "Invalid Crafting Job Request" );
}
CraftingJob job = new CraftingJob( world, grid, actionSrc, slotItem, cb );
final CraftingJob job = new CraftingJob( world, grid, actionSrc, slotItem, cb );
return CRAFTING_POOL.submit( job, (ICraftingJob) job );
}
@Override
public ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, final boolean prioritizePower, BaseActionSource src )
public ICraftingLink submitJob( final ICraftingJob job, final ICraftingRequester requestingMachine, final ICraftingCPU target, final boolean prioritizePower, final BaseActionSource src )
{
if( job.isSimulation() )
{
@@ -525,8 +525,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if( target == null )
{
List<CraftingCPUCluster> validCpusClusters = new ArrayList<CraftingCPUCluster>();
for( CraftingCPUCluster cpu : this.craftingCPUClusters )
final List<CraftingCPUCluster> validCpusClusters = new ArrayList<CraftingCPUCluster>();
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
{
if( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() )
{
@@ -537,11 +537,11 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
Collections.sort( validCpusClusters, new Comparator<CraftingCPUCluster>()
{
@Override
public int compare( CraftingCPUCluster firstCluster, CraftingCPUCluster nextCluster )
public int compare( final CraftingCPUCluster firstCluster, final CraftingCPUCluster nextCluster )
{
if( prioritizePower )
{
int comparison = ItemSorters.compareLong( nextCluster.getCoProcessors(), firstCluster.getCoProcessors() );
final int comparison = ItemSorters.compareLong( nextCluster.getCoProcessors(), firstCluster.getCoProcessors() );
if( comparison != 0 )
{
return comparison;
@@ -549,7 +549,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
return ItemSorters.compareLong( nextCluster.getAvailableStorage(), firstCluster.getAvailableStorage() );
}
int comparison = ItemSorters.compareLong( firstCluster.getCoProcessors(), nextCluster.getCoProcessors() );
final int comparison = ItemSorters.compareLong( firstCluster.getCoProcessors(), nextCluster.getCoProcessors() );
if( comparison != 0 )
{
return comparison;
@@ -579,15 +579,15 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
}
@Override
public boolean canEmitFor( IAEItemStack someItem )
public boolean canEmitFor( final IAEItemStack someItem )
{
return this.emitableItems.contains( someItem );
}
@Override
public boolean isRequesting( IAEItemStack what )
public boolean isRequesting( final IAEItemStack what )
{
for( CraftingCPUCluster cluster : this.craftingCPUClusters )
for( final CraftingCPUCluster cluster : this.craftingCPUClusters )
{
if( cluster.isMaking( what ) )
{
@@ -598,7 +598,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
return false;
}
public List<ICraftingMedium> getMediums( ICraftingPatternDetails key )
public List<ICraftingMedium> getMediums( final ICraftingPatternDetails key )
{
List<ICraftingMedium> mediums = this.craftingMethods.get( key );
@@ -610,7 +610,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
return mediums;
}
public boolean hasCpu( ICraftingCPU cpu )
public boolean hasCpu( final ICraftingCPU cpu )
{
return this.craftingCPUClusters.contains( cpu );
}
@@ -621,7 +621,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
private final Iterator<CraftingCPUCluster> iterator;
private CraftingCPUCluster cpuCluster;
public ActiveCpuIterator( Collection<CraftingCPUCluster> o )
public ActiveCpuIterator( final Collection<CraftingCPUCluster> o )
{
this.iterator = o.iterator();
this.cpuCluster = null;
+62 -62
View File
@@ -95,33 +95,33 @@ public class EnergyGridCache implements IEnergyGrid
PathGridCache pgc;
double lastStoredPower = -1;
public EnergyGridCache( IGrid g )
public EnergyGridCache( final IGrid g )
{
this.myGrid = g;
}
@MENetworkEventSubscribe
public void postInit( MENetworkPostCacheConstruction pcc )
public void postInit( final MENetworkPostCacheConstruction pcc )
{
this.pgc = this.myGrid.getCache( IPathingGrid.class );
}
@MENetworkEventSubscribe
public void EnergyNodeChanges( MENetworkPowerIdleChange ev )
public void EnergyNodeChanges( final MENetworkPowerIdleChange ev )
{
// update power usage based on event.
GridNode node = (GridNode) ev.node;
IGridBlock gb = node.getGridBlock();
final GridNode node = (GridNode) ev.node;
final IGridBlock gb = node.getGridBlock();
double newDraw = gb.getIdlePowerUsage();
double diffDraw = newDraw - node.previousDraw;
final double newDraw = gb.getIdlePowerUsage();
final double diffDraw = newDraw - node.previousDraw;
node.previousDraw = newDraw;
this.drainPerTick += diffDraw;
}
@MENetworkEventSubscribe
public void EnergyNodeChanges( MENetworkPowerStorage ev )
public void EnergyNodeChanges( final MENetworkPowerStorage ev )
{
if( ev.storage.isAEPublicPowerStorage() )
{
@@ -152,12 +152,12 @@ public class EnergyGridCache implements IEnergyGrid
{
if( !this.interests.isEmpty() )
{
double oldPower = this.lastStoredPower;
final double oldPower = this.lastStoredPower;
this.lastStoredPower = this.getStoredPower();
EnergyThreshold low = new EnergyThreshold( Math.min( oldPower, this.lastStoredPower ), null );
EnergyThreshold high = new EnergyThreshold( Math.max( oldPower, this.lastStoredPower ), null );
for( EnergyThreshold th : this.interests.subSet( low, true, high, true ) )
final EnergyThreshold low = new EnergyThreshold( Math.min( oldPower, this.lastStoredPower ), null );
final EnergyThreshold high = new EnergyThreshold( Math.max( oldPower, this.lastStoredPower ), null );
for( final EnergyThreshold th : this.interests.subSet( low, true, high, true ) )
{
( (EnergyWatcher) th.watcher ).post( this );
}
@@ -177,7 +177,7 @@ public class EnergyGridCache implements IEnergyGrid
if( this.drainPerTick > 0.0001 )
{
double drained = this.extractAEPower( this.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
final double drained = this.extractAEPower( this.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
currentlyHasPower = drained >= this.drainPerTick - 0.001;
}
else
@@ -212,7 +212,7 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public double extractAEPower( double amt, Actionable mode, PowerMultiplier pm )
public double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier pm )
{
this.localSeen.clear();
return pm.divide( this.extractAEPower( pm.multiply( amt ), mode, this.localSeen ) );
@@ -224,7 +224,7 @@ public class EnergyGridCache implements IEnergyGrid
return this.drainPerTick + this.pgc.channelPowerUsage;
}
private void publicPowerState( boolean newState, IGrid grid )
private void publicPowerState( final boolean newState, final IGrid grid )
{
if( this.publicHasPower == newState )
{
@@ -243,14 +243,14 @@ public class EnergyGridCache implements IEnergyGrid
{
this.availableTicksSinceUpdate = 0;
this.globalAvailablePower = 0;
for( IAEPowerStorage p : this.providers )
for( final IAEPowerStorage p : this.providers )
{
this.globalAvailablePower += p.getAECurrentPower();
}
}
@Override
public double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen )
public double extractAEPower( final double amt, final Actionable mode, final Set<IEnergyGrid> seen )
{
if( !seen.add( this ) )
{
@@ -265,7 +265,7 @@ public class EnergyGridCache implements IEnergyGrid
if( extractedPower < amt )
{
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
final Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
while( extractedPower < amt && i.hasNext() )
{
extractedPower += i.next().extractAEPower( amt - extractedPower, mode, seen );
@@ -292,7 +292,7 @@ public class EnergyGridCache implements IEnergyGrid
if( extractedPower < amt )
{
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
final Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
while( extractedPower < amt && i.hasNext() )
{
extractedPower += i.next().extractAEPower( amt - extractedPower, mode, seen );
@@ -306,26 +306,26 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen )
public double injectAEPower( double amt, final Actionable mode, final Set<IEnergyGrid> seen )
{
if( !seen.add( this ) )
{
return 0;
}
double ignore = this.extra;
final double ignore = this.extra;
amt += this.extra;
if( mode == Actionable.SIMULATE )
{
Iterator<IAEPowerStorage> it = this.requesters.iterator();
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
while( amt > 0 && it.hasNext() )
{
IAEPowerStorage node = it.next();
final IAEPowerStorage node = it.next();
amt = node.injectAEPower( amt, Actionable.SIMULATE );
}
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
final Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
while( amt > 0 && i.hasNext() )
{
amt = i.next().injectAEPower( amt, mode, seen );
@@ -338,7 +338,7 @@ public class EnergyGridCache implements IEnergyGrid
while( amt > 0 && !this.requesters.isEmpty() )
{
IAEPowerStorage node = this.getFirstRequester();
final IAEPowerStorage node = this.getFirstRequester();
amt = node.injectAEPower( amt, Actionable.MODULATE );
if( amt > 0 )
@@ -348,14 +348,14 @@ public class EnergyGridCache implements IEnergyGrid
}
}
Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
final Iterator<IEnergyGridProvider> i = this.energyGridProviders.iterator();
while( amt > 0 && i.hasNext() )
{
IEnergyGridProvider what = i.next();
Set<IEnergyGrid> listCopy = new HashSet<IEnergyGrid>();
final IEnergyGridProvider what = i.next();
final Set<IEnergyGrid> listCopy = new HashSet<IEnergyGrid>();
listCopy.addAll( seen );
double cannotHold = what.injectAEPower( amt, Actionable.SIMULATE, listCopy );
final double cannotHold = what.injectAEPower( amt, Actionable.SIMULATE, listCopy );
what.injectAEPower( amt - cannotHold, mode, seen );
amt = cannotHold;
@@ -368,7 +368,7 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public double getEnergyDemand( double maxRequired, Set<IEnergyGrid> seen )
public double getEnergyDemand( final double maxRequired, final Set<IEnergyGrid> seen )
{
if( !seen.add( this ) )
{
@@ -377,50 +377,50 @@ public class EnergyGridCache implements IEnergyGrid
double required = this.buffer() - this.extra;
Iterator<IAEPowerStorage> it = this.requesters.iterator();
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
while( required < maxRequired && it.hasNext() )
{
IAEPowerStorage node = it.next();
final IAEPowerStorage node = it.next();
if( node.getPowerFlow() != AccessRestriction.READ )
{
required += Math.max( 0.0, node.getAEMaxPower() - node.getAECurrentPower() );
}
}
Iterator<IEnergyGridProvider> ix = this.energyGridProviders.iterator();
final Iterator<IEnergyGridProvider> ix = this.energyGridProviders.iterator();
while( required < maxRequired && ix.hasNext() )
{
IEnergyGridProvider node = ix.next();
final IEnergyGridProvider node = ix.next();
required += node.getEnergyDemand( maxRequired - required, seen );
}
return required;
}
private double simulateExtract( double extractedPower, double amt )
private double simulateExtract( double extractedPower, final double amt )
{
Iterator<IAEPowerStorage> it = this.providers.iterator();
final Iterator<IAEPowerStorage> it = this.providers.iterator();
while( extractedPower < amt && it.hasNext() )
{
IAEPowerStorage node = it.next();
final IAEPowerStorage node = it.next();
double req = amt - extractedPower;
double newPower = node.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.ONE );
final double req = amt - extractedPower;
final double newPower = node.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.ONE );
extractedPower += newPower;
}
return extractedPower;
}
private double doExtract( double extractedPower, double amt )
private double doExtract( double extractedPower, final double amt )
{
while( extractedPower < amt && !this.providers.isEmpty() )
{
IAEPowerStorage node = this.getFirstProvider();
final IAEPowerStorage node = this.getFirstProvider();
double req = amt - extractedPower;
double newPower = node.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.ONE );
final double req = amt - extractedPower;
final double newPower = node.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.ONE );
extractedPower += newPower;
if( newPower < req )
@@ -438,7 +438,7 @@ public class EnergyGridCache implements IEnergyGrid
{
if( this.lastProvider == null )
{
Iterator<IAEPowerStorage> i = this.providers.iterator();
final Iterator<IAEPowerStorage> i = this.providers.iterator();
this.lastProvider = i.hasNext() ? i.next() : null;
}
@@ -464,7 +464,7 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public double injectPower( double amt, Actionable mode )
public double injectPower( final double amt, final Actionable mode )
{
this.localSeen.clear();
return this.injectAEPower( amt, mode, this.localSeen );
@@ -474,7 +474,7 @@ public class EnergyGridCache implements IEnergyGrid
{
if( this.lastRequester == null )
{
Iterator<IAEPowerStorage> i = this.requesters.iterator();
final Iterator<IAEPowerStorage> i = this.requesters.iterator();
this.lastRequester = i.hasNext() ? i.next() : null;
}
@@ -504,14 +504,14 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public double getEnergyDemand( double maxRequired )
public double getEnergyDemand( final double maxRequired )
{
this.localSeen.clear();
return this.getEnergyDemand( maxRequired, this.localSeen );
}
@Override
public void removeNode( IGridNode node, IGridHost machine )
public void removeNode( final IGridNode node, final IGridHost machine )
{
if( machine instanceof IEnergyGridProvider )
{
@@ -519,13 +519,13 @@ public class EnergyGridCache implements IEnergyGrid
}
// idle draw.
GridNode gridNode = (GridNode) node;
final GridNode gridNode = (GridNode) node;
this.drainPerTick -= gridNode.previousDraw;
// power storage.
if( machine instanceof IAEPowerStorage )
{
IAEPowerStorage ps = (IAEPowerStorage) machine;
final IAEPowerStorage ps = (IAEPowerStorage) machine;
if( ps.isAEPublicPowerStorage() )
{
if( ps.getPowerFlow() != AccessRestriction.WRITE )
@@ -551,7 +551,7 @@ public class EnergyGridCache implements IEnergyGrid
if( machine instanceof IStackWatcherHost )
{
IEnergyWatcher myWatcher = this.watchers.get( machine );
final IEnergyWatcher myWatcher = this.watchers.get( machine );
if( myWatcher != null )
{
myWatcher.clear();
@@ -561,7 +561,7 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public void addNode( IGridNode node, IGridHost machine )
public void addNode( final IGridNode node, final IGridHost machine )
{
if( machine instanceof IEnergyGridProvider )
{
@@ -569,19 +569,19 @@ public class EnergyGridCache implements IEnergyGrid
}
// idle draw...
GridNode gridNode = (GridNode) node;
IGridBlock gb = gridNode.getGridBlock();
final GridNode gridNode = (GridNode) node;
final IGridBlock gb = gridNode.getGridBlock();
gridNode.previousDraw = gb.getIdlePowerUsage();
this.drainPerTick += gridNode.previousDraw;
// power storage
if( machine instanceof IAEPowerStorage )
{
IAEPowerStorage ps = (IAEPowerStorage) machine;
final IAEPowerStorage ps = (IAEPowerStorage) machine;
if( ps.isAEPublicPowerStorage() )
{
double max = ps.getAEMaxPower();
double current = ps.getAECurrentPower();
final double max = ps.getAEMaxPower();
final double current = ps.getAECurrentPower();
if( ps.getPowerFlow() != AccessRestriction.WRITE )
{
@@ -603,8 +603,8 @@ public class EnergyGridCache implements IEnergyGrid
if( machine instanceof IEnergyWatcherHost )
{
IEnergyWatcherHost swh = (IEnergyWatcherHost) machine;
EnergyWatcher iw = new EnergyWatcher( this, swh );
final IEnergyWatcherHost swh = (IEnergyWatcherHost) machine;
final EnergyWatcher iw = new EnergyWatcher( this, swh );
this.watchers.put( node, iw );
swh.updateWatcher( iw );
}
@@ -613,20 +613,20 @@ public class EnergyGridCache implements IEnergyGrid
}
@Override
public void onSplit( IGridStorage storageB )
public void onSplit( final IGridStorage storageB )
{
this.extra /= 2;
storageB.dataObject().setDouble( "extraEnergy", this.extra );
}
@Override
public void onJoin( IGridStorage storageB )
public void onJoin( final IGridStorage storageB )
{
this.extra += storageB.dataObject().getDouble( "extraEnergy" );
}
@Override
public void populateGridStorage( IGridStorage storage )
public void populateGridStorage( final IGridStorage storage )
{
storage.dataObject().setDouble( "extraEnergy", this.extra );
}
+35 -35
View File
@@ -69,7 +69,7 @@ public class GridStorageCache implements IStorageGrid
private NetworkInventoryHandler<IAEItemStack> myItemNetwork;
private NetworkInventoryHandler<IAEFluidStack> myFluidNetwork;
public GridStorageCache( IGrid g )
public GridStorageCache( final IGrid g )
{
this.myGrid = g;
}
@@ -82,11 +82,11 @@ public class GridStorageCache implements IStorageGrid
}
@Override
public void removeNode( IGridNode node, IGridHost machine )
public void removeNode( final IGridNode node, final IGridHost machine )
{
if( machine instanceof ICellContainer )
{
ICellContainer cc = (ICellContainer) machine;
final ICellContainer cc = (ICellContainer) machine;
this.myGrid.postEvent( new MENetworkCellArrayUpdate() );
this.removeCellProvider( cc, new CellChangeTracker() ).applyChanges();
@@ -95,7 +95,7 @@ public class GridStorageCache implements IStorageGrid
if( machine instanceof IStackWatcherHost )
{
IStackWatcher myWatcher = this.watchers.get( machine );
final IStackWatcher myWatcher = this.watchers.get( machine );
if( myWatcher != null )
{
myWatcher.clear();
@@ -105,11 +105,11 @@ public class GridStorageCache implements IStorageGrid
}
@Override
public void addNode( IGridNode node, IGridHost machine )
public void addNode( final IGridNode node, final IGridHost machine )
{
if( machine instanceof ICellContainer )
{
ICellContainer cc = (ICellContainer) machine;
final ICellContainer cc = (ICellContainer) machine;
this.inactiveCellProviders.add( cc );
this.myGrid.postEvent( new MENetworkCellArrayUpdate() );
@@ -121,32 +121,32 @@ public class GridStorageCache implements IStorageGrid
if( machine instanceof IStackWatcherHost )
{
IStackWatcherHost swh = (IStackWatcherHost) machine;
ItemWatcher iw = new ItemWatcher( this, swh );
final IStackWatcherHost swh = (IStackWatcherHost) machine;
final ItemWatcher iw = new ItemWatcher( this, swh );
this.watchers.put( node, iw );
swh.updateWatcher( iw );
}
}
@Override
public void onSplit( IGridStorage storageB )
public void onSplit( final IGridStorage storageB )
{
}
@Override
public void onJoin( IGridStorage storageB )
public void onJoin( final IGridStorage storageB )
{
}
@Override
public void populateGridStorage( IGridStorage storage )
public void populateGridStorage( final IGridStorage storage )
{
}
public CellChangeTracker addCellProvider( ICellProvider cc, CellChangeTracker tracker )
public CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
{
if( this.inactiveCellProviders.contains( cc ) )
{
@@ -159,12 +159,12 @@ public class GridStorageCache implements IStorageGrid
actionSrc = new MachineSource( (IActionHost) cc );
}
for( IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
{
tracker.postChanges( StorageChannel.ITEMS, 1, h, actionSrc );
}
for( IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ) )
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ) )
{
tracker.postChanges( StorageChannel.FLUIDS, 1, h, actionSrc );
}
@@ -173,7 +173,7 @@ public class GridStorageCache implements IStorageGrid
return tracker;
}
public CellChangeTracker removeCellProvider( ICellProvider cc, CellChangeTracker tracker )
public CellChangeTracker removeCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
{
if( this.activeCellProviders.contains( cc ) )
{
@@ -186,12 +186,12 @@ public class GridStorageCache implements IStorageGrid
actionSrc = new MachineSource( (IActionHost) cc );
}
for( IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( StorageChannel.ITEMS ) )
{
tracker.postChanges( StorageChannel.ITEMS, -1, h, actionSrc );
}
for( IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ) )
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( StorageChannel.FLUIDS ) )
{
tracker.postChanges( StorageChannel.FLUIDS, -1, h, actionSrc );
}
@@ -201,24 +201,24 @@ public class GridStorageCache implements IStorageGrid
}
@MENetworkEventSubscribe
public void cellUpdate( MENetworkCellArrayUpdate ev )
public void cellUpdate( final MENetworkCellArrayUpdate ev )
{
this.myItemNetwork = null;
this.myFluidNetwork = null;
LinkedList<ICellProvider> ll = new LinkedList();
final LinkedList<ICellProvider> ll = new LinkedList();
ll.addAll( this.inactiveCellProviders );
ll.addAll( this.activeCellProviders );
CellChangeTracker tracker = new CellChangeTracker();
final CellChangeTracker tracker = new CellChangeTracker();
for( ICellProvider cc : ll )
for( final ICellProvider cc : ll )
{
boolean Active = true;
if( cc instanceof IActionHost )
{
IGridNode node = ( (IActionHost) cc ).getActionableNode();
final IGridNode node = ( (IActionHost) cc ).getActionableNode();
if( node != null && node.isActive() )
{
Active = true;
@@ -245,7 +245,7 @@ public class GridStorageCache implements IStorageGrid
tracker.applyChanges();
}
private void postChangesToNetwork( StorageChannel chan, int upOrDown, IItemList availableItems, BaseActionSource src )
private void postChangesToNetwork( final StorageChannel chan, final int upOrDown, final IItemList availableItems, final BaseActionSource src )
{
switch( chan )
{
@@ -268,17 +268,17 @@ public class GridStorageCache implements IStorageGrid
return this.myItemNetwork;
}
private void buildNetworkStorage( StorageChannel chan )
private void buildNetworkStorage( final StorageChannel chan )
{
SecurityCache security = this.myGrid.getCache( ISecurityGrid.class );
final SecurityCache security = this.myGrid.getCache( ISecurityGrid.class );
switch( chan )
{
case FLUIDS:
this.myFluidNetwork = new NetworkInventoryHandler<IAEFluidStack>( StorageChannel.FLUIDS, security );
for( ICellProvider cc : this.activeCellProviders )
for( final ICellProvider cc : this.activeCellProviders )
{
for( IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) )
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) )
{
this.myFluidNetwork.addNewStorage( h );
}
@@ -286,9 +286,9 @@ public class GridStorageCache implements IStorageGrid
break;
case ITEMS:
this.myItemNetwork = new NetworkInventoryHandler<IAEItemStack>( StorageChannel.ITEMS, security );
for( ICellProvider cc : this.activeCellProviders )
for( final ICellProvider cc : this.activeCellProviders )
{
for( IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) )
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) )
{
this.myItemNetwork.addNewStorage( h );
}
@@ -308,7 +308,7 @@ public class GridStorageCache implements IStorageGrid
}
@Override
public void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src )
public void postAlterationOfStoredItems( final StorageChannel chan, final Iterable<? extends IAEStack> input, final BaseActionSource src )
{
if( chan == StorageChannel.ITEMS )
{
@@ -321,14 +321,14 @@ public class GridStorageCache implements IStorageGrid
}
@Override
public void registerCellProvider( ICellProvider provider )
public void registerCellProvider( final ICellProvider provider )
{
this.inactiveCellProviders.add( provider );
this.addCellProvider( provider, new CellChangeTracker() ).applyChanges();
}
@Override
public void unregisterCellProvider( ICellProvider provider )
public void unregisterCellProvider( final ICellProvider provider )
{
this.removeCellProvider( provider, new CellChangeTracker() ).applyChanges();
this.inactiveCellProviders.remove( provider );
@@ -354,7 +354,7 @@ public class GridStorageCache implements IStorageGrid
final IItemList list;
final BaseActionSource src;
public CellChangeTrackerRecord( StorageChannel channel, int i, IMEInventoryHandler<? extends IAEStack> h, BaseActionSource actionSrc )
public CellChangeTrackerRecord( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc )
{
this.channel = channel;
this.up_or_down = i;
@@ -386,14 +386,14 @@ public class GridStorageCache implements IStorageGrid
final List<CellChangeTrackerRecord> data = new LinkedList<CellChangeTrackerRecord>();
public void postChanges( StorageChannel channel, int i, IMEInventoryHandler<? extends IAEStack> h, BaseActionSource actionSrc )
public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc )
{
this.data.add( new CellChangeTrackerRecord( channel, i, h, actionSrc ) );
}
public void applyChanges()
{
for( CellChangeTrackerRecord rec : this.data )
for( final CellChangeTrackerRecord rec : this.data )
{
rec.applyChanges();
}
+10 -10
View File
@@ -44,7 +44,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
private final StorageChannel myChannel;
boolean sendEvent = false;
public NetworkMonitor( GridStorageCache cache, StorageChannel chan )
public NetworkMonitor( final GridStorageCache cache, final StorageChannel chan )
{
super( null, chan );
this.myGridCache = cache;
@@ -55,11 +55,11 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
{
this.hasChanged = true;
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.getListeners();
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.getListeners();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<T>, Object> o = i.next();
IMEMonitorHandlerReceiver<T> receiver = o.getKey();
final Entry<IMEMonitorHandlerReceiver<T>, Object> o = i.next();
final IMEMonitorHandlerReceiver<T> receiver = o.getKey();
if( receiver.isValid( o.getValue() ) )
{
@@ -96,12 +96,12 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
}
@Override
protected void postChangesToListeners( Iterable<T> changes, BaseActionSource src )
protected void postChangesToListeners( final Iterable<T> changes, final BaseActionSource src )
{
this.postChange( true, changes, src );
}
protected void postChange( boolean add, Iterable<T> changes, BaseActionSource src )
protected void postChange( final boolean add, final Iterable<T> changes, final BaseActionSource src )
{
if( DEPTH.contains( this ) )
{
@@ -113,9 +113,9 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
this.sendEvent = true;
this.notifyListenersOfChange( changes, src );
IItemList<T> myStorageList = this.getStorageList();
final IItemList<T> myStorageList = this.getStorageList();
for( T changedItem : changes )
for( final T changedItem : changes )
{
T difference = changedItem;
@@ -126,7 +126,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
if( this.myGridCache.interestManager.containsKey( changedItem ) )
{
Collection<ItemWatcher> list = this.myGridCache.interestManager.get( changedItem );
final Collection<ItemWatcher> list = this.myGridCache.interestManager.get( changedItem );
if( !list.isEmpty() )
{
IAEStack fullStack = myStorageList.findPrecise( changedItem );
@@ -138,7 +138,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
this.myGridCache.interestManager.enableTransactions();
for( ItemWatcher iw : list )
for( final ItemWatcher iw : list )
{
iw.getHost().onStackChange( myStorageList, fullStack, difference, src, this.getChannel() );
}
+22 -22
View File
@@ -47,16 +47,16 @@ public class P2PCache implements IGridCache
private final Multimap<Long, PartP2PTunnel> outputs = LinkedHashMultimap.create();
private final TunnelCollection NullColl = new TunnelCollection<PartP2PTunnel>( null, null );
public P2PCache( IGrid g )
public P2PCache( final IGrid g )
{
this.myGrid = g;
}
@MENetworkEventSubscribe
public void bootComplete( MENetworkBootingStatusChange bootStatus )
public void bootComplete( final MENetworkBootingStatusChange bootStatus )
{
ITickManager tm = this.myGrid.getCache( ITickManager.class );
for( PartP2PTunnel me : this.inputs.values() )
final ITickManager tm = this.myGrid.getCache( ITickManager.class );
for( final PartP2PTunnel me : this.inputs.values() )
{
if( me instanceof PartP2PTunnelME )
{
@@ -66,10 +66,10 @@ public class P2PCache implements IGridCache
}
@MENetworkEventSubscribe
public void bootComplete( MENetworkPowerStatusChange power )
public void bootComplete( final MENetworkPowerStatusChange power )
{
ITickManager tm = this.myGrid.getCache( ITickManager.class );
for( PartP2PTunnel me : this.inputs.values() )
final ITickManager tm = this.myGrid.getCache( ITickManager.class );
for( final PartP2PTunnel me : this.inputs.values() )
{
if( me instanceof PartP2PTunnelME )
{
@@ -85,7 +85,7 @@ public class P2PCache implements IGridCache
}
@Override
public void removeNode( IGridNode node, IGridHost machine )
public void removeNode( final IGridNode node, final IGridHost machine )
{
if( machine instanceof PartP2PTunnel )
{
@@ -97,7 +97,7 @@ public class P2PCache implements IGridCache
}
}
PartP2PTunnel t = (PartP2PTunnel) machine;
final PartP2PTunnel t = (PartP2PTunnel) machine;
// AELog.info( "rmv-" + (t.output ? "output: " : "input: ") + t.freq
// );
@@ -115,7 +115,7 @@ public class P2PCache implements IGridCache
}
@Override
public void addNode( IGridNode node, IGridHost machine )
public void addNode( final IGridNode node, final IGridHost machine )
{
if( machine instanceof PartP2PTunnel )
{
@@ -127,7 +127,7 @@ public class P2PCache implements IGridCache
}
}
PartP2PTunnel t = (PartP2PTunnel) machine;
final PartP2PTunnel t = (PartP2PTunnel) machine;
// AELog.info( "add-" + (t.output ? "output: " : "input: ") + t.freq
// );
@@ -145,26 +145,26 @@ public class P2PCache implements IGridCache
}
@Override
public void onSplit( IGridStorage storageB )
public void onSplit( final IGridStorage storageB )
{
}
@Override
public void onJoin( IGridStorage storageB )
public void onJoin( final IGridStorage storageB )
{
}
@Override
public void populateGridStorage( IGridStorage storage )
public void populateGridStorage( final IGridStorage storage )
{
}
private void updateTunnel( long freq, boolean updateOutputs, boolean configChange )
private void updateTunnel( final long freq, final boolean updateOutputs, final boolean configChange )
{
for( PartP2PTunnel p : this.outputs.get( freq ) )
for( final PartP2PTunnel p : this.outputs.get( freq ) )
{
if( configChange )
{
@@ -173,7 +173,7 @@ public class P2PCache implements IGridCache
p.onTunnelNetworkChange();
}
PartP2PTunnel in = this.inputs.get( freq );
final PartP2PTunnel in = this.inputs.get( freq );
if( in != null )
{
if( configChange )
@@ -184,7 +184,7 @@ public class P2PCache implements IGridCache
}
}
public void updateFreq( PartP2PTunnel t, long newFrequency )
public void updateFreq( final PartP2PTunnel t, final long newFrequency )
{
if( this.outputs.containsValue( t ) )
{
@@ -213,15 +213,15 @@ public class P2PCache implements IGridCache
this.updateTunnel( t.freq, !t.output, true );
}
public TunnelCollection<PartP2PTunnel> getOutputs( long freq, Class<? extends PartP2PTunnel> c )
public TunnelCollection<PartP2PTunnel> getOutputs( final long freq, final Class<? extends PartP2PTunnel> c )
{
PartP2PTunnel in = this.inputs.get( freq );
final 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 );
final TunnelCollection<PartP2PTunnel> out = this.inputs.get( freq ).getCollection( this.outputs.get( freq ), c );
if( out == null )
{
return this.NullColl;
@@ -230,7 +230,7 @@ public class P2PCache implements IGridCache
return out;
}
public PartP2PTunnel getInput( long freq )
public PartP2PTunnel getInput( final long freq )
{
return this.inputs.get( freq );
}
+37 -37
View File
@@ -76,7 +76,7 @@ public class PathGridCache implements IPathingGrid
int lastChannels = 0;
private HashSet<IPathItem> semiOpen = new HashSet<IPathItem>();
public PathGridCache( IGrid g )
public PathGridCache( final IGrid g )
{
this.myGrid = g;
}
@@ -103,9 +103,9 @@ public class PathGridCache implements IPathingGrid
if( !AEConfig.instance.isFeatureEnabled( AEFeature.Channels ) )
{
int used = this.calculateRequiredChannels();
final int used = this.calculateRequiredChannels();
int nodes = this.myGrid.getNodes().size();
final int nodes = this.myGrid.getNodes().size();
this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 );
this.channelsByBlocks = nodes * used;
this.channelPowerUsage = this.channelsByBlocks / 128.0;
@@ -114,14 +114,14 @@ public class PathGridCache implements IPathingGrid
}
else if( this.controllerState == ControllerState.NO_CONTROLLER )
{
int requiredChannels = this.calculateRequiredChannels();
final int requiredChannels = this.calculateRequiredChannels();
int used = requiredChannels;
if( requiredChannels > 8 )
{
used = 0;
}
int nodes = this.myGrid.getNodes().size();
final int nodes = this.myGrid.getNodes().size();
this.channelsInUse = used;
this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 );
@@ -137,22 +137,22 @@ public class PathGridCache implements IPathingGrid
}
else
{
int nodes = this.myGrid.getNodes().size();
final int nodes = this.myGrid.getNodes().size();
this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 );
HashSet<IPathItem> closedList = new HashSet<IPathItem>();
final HashSet<IPathItem> closedList = new HashSet<IPathItem>();
this.semiOpen = new HashSet<IPathItem>();
// myGrid.getPivot().beginVisit( new AdHocChannelUpdater( 0 )
// );
for( IGridNode node : this.myGrid.getMachines( TileController.class ) )
for( final IGridNode node : this.myGrid.getMachines( TileController.class ) )
{
closedList.add( (IPathItem) node );
for( IGridConnection gcc : node.getConnections() )
for( final IGridConnection gcc : node.getConnections() )
{
GridConnection gc = (GridConnection) gcc;
final GridConnection gc = (GridConnection) gcc;
if( !( gc.getOtherSide( node ).getMachine() instanceof TileController ) )
{
List<IPathItem> open = new LinkedList<IPathItem>();
final List<IPathItem> open = new LinkedList<IPathItem>();
closedList.add( gc );
open.add( gc );
gc.setControllerRoute( (GridNode) node, true );
@@ -165,10 +165,10 @@ public class PathGridCache implements IPathingGrid
if( !this.active.isEmpty() || this.ticksUntilReady > 0 )
{
Iterator<PathSegment> i = this.active.iterator();
final Iterator<PathSegment> i = this.active.iterator();
while( i.hasNext() )
{
PathSegment pat = i.next();
final PathSegment pat = i.next();
if( pat.step() )
{
pat.isDead = true;
@@ -201,7 +201,7 @@ public class PathGridCache implements IPathingGrid
}
@Override
public void removeNode( IGridNode gridNode, IGridHost machine )
public void removeNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof TileController )
{
@@ -209,7 +209,7 @@ public class PathGridCache implements IPathingGrid
this.recalculateControllerNextTick = true;
}
EnumSet<GridFlags> flags = gridNode.getGridBlock().getFlags();
final EnumSet<GridFlags> flags = gridNode.getGridBlock().getFlags();
if( flags.contains( GridFlags.REQUIRE_CHANNEL ) )
{
@@ -225,7 +225,7 @@ public class PathGridCache implements IPathingGrid
}
@Override
public void addNode( IGridNode gridNode, IGridHost machine )
public void addNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof TileController )
{
@@ -233,7 +233,7 @@ public class PathGridCache implements IPathingGrid
this.recalculateControllerNextTick = true;
}
EnumSet<GridFlags> flags = gridNode.getGridBlock().getFlags();
final EnumSet<GridFlags> flags = gridNode.getGridBlock().getFlags();
if( flags.contains( GridFlags.REQUIRE_CHANNEL ) )
{
@@ -249,19 +249,19 @@ public class PathGridCache implements IPathingGrid
}
@Override
public void onSplit( IGridStorage storageB )
public void onSplit( final IGridStorage storageB )
{
}
@Override
public void onJoin( IGridStorage storageB )
public void onJoin( final IGridStorage storageB )
{
}
@Override
public void populateGridStorage( IGridStorage storage )
public void populateGridStorage( final IGridStorage storage )
{
}
@@ -269,7 +269,7 @@ public class PathGridCache implements IPathingGrid
private void recalcController()
{
this.recalculateControllerNextTick = false;
ControllerState old = this.controllerState;
final ControllerState old = this.controllerState;
if( this.controllers.isEmpty() )
{
@@ -277,15 +277,15 @@ public class PathGridCache implements IPathingGrid
}
else
{
IGridNode startingNode = this.controllers.iterator().next().getGridNode( AEPartLocation.INTERNAL );
final IGridNode startingNode = this.controllers.iterator().next().getGridNode( AEPartLocation.INTERNAL );
if( startingNode == null )
{
this.controllerState = ControllerState.CONTROLLER_CONFLICT;
return;
}
DimensionalCoord dc = startingNode.getGridBlock().getLocation();
ControllerValidator cv = new ControllerValidator( dc.x, dc.y, dc.z );
final DimensionalCoord dc = startingNode.getGridBlock().getLocation();
final ControllerValidator cv = new ControllerValidator( dc.x, dc.y, dc.z );
startingNode.beginVisit( cv );
@@ -310,12 +310,12 @@ public class PathGridCache implements IPathingGrid
this.semiOpen.clear();
int depth = 0;
for( IGridNode nodes : this.requireChannels )
for( final IGridNode nodes : this.requireChannels )
{
if( !this.semiOpen.contains( nodes ) )
{
IGridBlock gb = nodes.getGridBlock();
EnumSet<GridFlags> flags = gb.getFlags();
final IGridBlock gb = nodes.getGridBlock();
final EnumSet<GridFlags> flags = gb.getFlags();
if( flags.contains( GridFlags.COMPRESSED_CHANNEL ) && !this.blockDense.isEmpty() )
{
@@ -326,8 +326,8 @@ public class PathGridCache implements IPathingGrid
if( flags.contains( GridFlags.MULTIBLOCK ) )
{
IGridMultiblock gmb = (IGridMultiblock) gb;
Iterator<IGridNode> i = gmb.getMultiblockNodes();
final IGridMultiblock gmb = (IGridMultiblock) gb;
final Iterator<IGridNode> i = gmb.getMultiblockNodes();
while( i.hasNext() )
{
this.semiOpen.add( (IPathItem) i.next() );
@@ -343,17 +343,17 @@ public class PathGridCache implements IPathingGrid
{
if( this.lastChannels != this.channelsInUse && AEConfig.instance.isFeatureEnabled( AEFeature.Channels ) )
{
Achievements currentBracket = this.getAchievementBracket( this.channelsInUse );
Achievements lastBracket = this.getAchievementBracket( this.lastChannels );
final Achievements currentBracket = this.getAchievementBracket( this.channelsInUse );
final Achievements lastBracket = this.getAchievementBracket( this.lastChannels );
if( currentBracket != lastBracket && currentBracket != null )
{
Set<Integer> players = new HashSet<Integer>();
for( IGridNode n : this.requireChannels )
final Set<Integer> players = new HashSet<Integer>();
for( final IGridNode n : this.requireChannels )
{
players.add( n.getPlayerID() );
}
for( int id : players )
for( final int id : players )
{
Platform.addStat( id, currentBracket.getAchievement() );
}
@@ -362,7 +362,7 @@ public class PathGridCache implements IPathingGrid
this.lastChannels = this.channelsInUse;
}
private Achievements getAchievementBracket( int ch )
private Achievements getAchievementBracket( final int ch )
{
if( ch < 8 )
{
@@ -383,9 +383,9 @@ public class PathGridCache implements IPathingGrid
}
@MENetworkEventSubscribe
void updateNodReq( MENetworkChannelChanged ev )
void updateNodReq( final MENetworkChannelChanged ev )
{
IGridNode gridNode = ev.node;
final IGridNode gridNode = ev.node;
if( gridNode.getGridBlock().getFlags().contains( GridFlags.REQUIRE_CHANNEL ) )
{
+12 -12
View File
@@ -49,13 +49,13 @@ public class SecurityCache implements ISecurityGrid
private final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<Integer, EnumSet<SecurityPermissions>>();
private long securityKey = -1;
public SecurityCache( IGrid g )
public SecurityCache( final IGrid g )
{
this.myGrid = g;
}
@MENetworkEventSubscribe
public void updatePermissions( MENetworkSecurityChange ev )
public void updatePermissions( final MENetworkSecurityChange ev )
{
this.playerPerms.clear();
if( this.securityProvider.isEmpty() )
@@ -78,7 +78,7 @@ public class SecurityCache implements ISecurityGrid
}
@Override
public void removeNode( IGridNode gridNode, IGridHost machine )
public void removeNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof ISecurityProvider )
{
@@ -89,7 +89,7 @@ public class SecurityCache implements ISecurityGrid
private void updateSecurityKey()
{
long lastCode = this.securityKey;
final long lastCode = this.securityKey;
if( this.securityProvider.size() == 1 )
{
@@ -103,7 +103,7 @@ public class SecurityCache implements ISecurityGrid
if( lastCode != this.securityKey )
{
this.myGrid.postEvent( new MENetworkSecurityChange() );
for( IGridNode n : this.myGrid.getNodes() )
for( final IGridNode n : this.myGrid.getNodes() )
{
( (GridNode) n ).lastSecurityKey = this.securityKey;
}
@@ -111,7 +111,7 @@ public class SecurityCache implements ISecurityGrid
}
@Override
public void addNode( IGridNode gridNode, IGridHost machine )
public void addNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof ISecurityProvider )
{
@@ -125,19 +125,19 @@ public class SecurityCache implements ISecurityGrid
}
@Override
public void onSplit( IGridStorage destinationStorage )
public void onSplit( final IGridStorage destinationStorage )
{
}
@Override
public void onJoin( IGridStorage sourceStorage )
public void onJoin( final IGridStorage sourceStorage )
{
}
@Override
public void populateGridStorage( IGridStorage destinationStorage )
public void populateGridStorage( final IGridStorage destinationStorage )
{
} @Override
@@ -149,7 +149,7 @@ public class SecurityCache implements ISecurityGrid
@Override
public boolean hasPermission( EntityPlayer player, SecurityPermissions perm )
public boolean hasPermission( final EntityPlayer player, final SecurityPermissions perm )
{
Preconditions.checkNotNull( player );
Preconditions.checkNotNull( perm );
@@ -161,11 +161,11 @@ public class SecurityCache implements ISecurityGrid
}
@Override
public boolean hasPermission( int playerID, SecurityPermissions perm )
public boolean hasPermission( final int playerID, final SecurityPermissions perm )
{
if( this.isAvailable() )
{
EnumSet<SecurityPermissions> perms = this.playerPerms.get( playerID );
final EnumSet<SecurityPermissions> perms = this.playerPerms.get( playerID );
if( perms == null )
{
+21 -21
View File
@@ -51,34 +51,34 @@ public class SpatialPylonCache implements ISpatialCache
HashMap<SpatialPylonCluster, SpatialPylonCluster> clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>();
boolean needsUpdate = false;
public SpatialPylonCache( IGrid g )
public SpatialPylonCache( final IGrid g )
{
this.myGrid = g;
}
@MENetworkEventSubscribe
public void bootingRender( MENetworkBootingStatusChange c )
public void bootingRender( final MENetworkBootingStatusChange c )
{
this.reset( this.myGrid );
}
public void reset( IGrid grid )
public void reset( final IGrid grid )
{
this.clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>();
this.ioPorts = new LinkedList<TileSpatialIOPort>();
for( IGridNode gm : grid.getMachines( TileSpatialIOPort.class ) )
for( final IGridNode gm : grid.getMachines( TileSpatialIOPort.class ) )
{
this.ioPorts.add( (TileSpatialIOPort) gm.getMachine() );
}
IReadOnlyCollection<IGridNode> set = grid.getMachines( TileSpatialPylon.class );
for( IGridNode gm : set )
final IReadOnlyCollection<IGridNode> set = grid.getMachines( TileSpatialPylon.class );
for( final IGridNode gm : set )
{
if( gm.meetsChannelRequirements() )
{
SpatialPylonCluster c = ( (TileSpatialPylon) gm.getMachine() ).getCluster();
final SpatialPylonCluster c = ( (TileSpatialPylon) gm.getMachine() ).getCluster();
if( c != null )
{
this.clusters.put( c, c );
@@ -91,7 +91,7 @@ public class SpatialPylonCache implements ISpatialCache
this.isValid = true;
int pylonBlocks = 0;
for( SpatialPylonCluster cl : this.clusters.values() )
for( final SpatialPylonCluster cl : this.clusters.values() )
{
if( this.captureMax == null )
{
@@ -119,7 +119,7 @@ public class SpatialPylonCache implements ISpatialCache
{
this.isValid = this.captureMax.x - this.captureMin.x > 1 && this.captureMax.y - this.captureMin.y > 1 && this.captureMax.z - this.captureMin.z > 1;
for( SpatialPylonCluster cl : this.clusters.values() )
for( final SpatialPylonCluster cl : this.clusters.values() )
{
switch( cl.currentAxis )
{
@@ -144,10 +144,10 @@ public class SpatialPylonCache implements ISpatialCache
}
}
int reqX = this.captureMax.x - this.captureMin.x;
int reqY = this.captureMax.y - this.captureMin.y;
int reqZ = this.captureMax.z - this.captureMin.z;
int requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 );
final int reqX = this.captureMax.x - this.captureMin.x;
final int reqY = this.captureMax.y - this.captureMin.y;
final int reqZ = this.captureMax.z - this.captureMin.z;
final int requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 );
this.efficiency = (double) pylonBlocks / (double) requirePylonBlocks;
@@ -164,12 +164,12 @@ public class SpatialPylonCache implements ISpatialCache
maxPower = Math.pow( minPower, AEConfig.instance.spatialPowerExponent );
}
double affective_efficiency = Math.pow( this.efficiency, 0.25 );
final double affective_efficiency = Math.pow( this.efficiency, 0.25 );
this.powerRequired = (long) ( affective_efficiency * minPower + ( 1.0 - affective_efficiency ) * maxPower );
for( SpatialPylonCluster cl : this.clusters.values() )
for( final SpatialPylonCluster cl : this.clusters.values() )
{
boolean myWasValid = cl.isValid;
final boolean myWasValid = cl.isValid;
cl.isValid = this.isValid;
if( myWasValid != this.isValid )
{
@@ -220,31 +220,31 @@ public class SpatialPylonCache implements ISpatialCache
}
@Override
public void removeNode( IGridNode node, IGridHost machine )
public void removeNode( final IGridNode node, final IGridHost machine )
{
}
@Override
public void addNode( IGridNode node, IGridHost machine )
public void addNode( final IGridNode node, final IGridHost machine )
{
}
@Override
public void onSplit( IGridStorage storageB )
public void onSplit( final IGridStorage storageB )
{
}
@Override
public void onJoin( IGridStorage storageB )
public void onJoin( final IGridStorage storageB )
{
}
@Override
public void populateGridStorage( IGridStorage storage )
public void populateGridStorage( final IGridStorage storage )
{
}
+21 -21
View File
@@ -46,7 +46,7 @@ public class TickManagerCache implements ITickManager
final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<TickTracker>();
private long currentTick = 0;
public TickManagerCache( IGrid g )
public TickManagerCache( final IGrid g )
{
this.myGrid = g;
}
@@ -56,7 +56,7 @@ public class TickManagerCache implements ITickManager
return this.currentTick;
}
public long getAvgNanoTime( IGridNode node )
public long getAvgNanoTime( final IGridNode node )
{
TickTracker tt = this.awake.get( node );
@@ -83,12 +83,12 @@ public class TickManagerCache implements ITickManager
while( !this.upcomingTicks.isEmpty() )
{
tt = this.upcomingTicks.peek();
int diff = (int) ( this.currentTick - tt.lastTick );
final int diff = (int) ( this.currentTick - tt.lastTick );
if( diff >= tt.current_rate )
{
// remove tt..
this.upcomingTicks.poll();
TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff );
final TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff );
switch( mod )
{
@@ -124,23 +124,23 @@ public class TickManagerCache implements ITickManager
}
}
}
catch( Throwable t )
catch( final Throwable t )
{
CrashReport crashreport = CrashReport.makeCrashReport( t, "Ticking GridNode" );
CrashReportCategory crashreportcategory = crashreport.makeCategory( tt.gt.getClass().getSimpleName() + " being ticked." );
final CrashReport crashreport = CrashReport.makeCrashReport( t, "Ticking GridNode" );
final CrashReportCategory crashreportcategory = crashreport.makeCategory( tt.gt.getClass().getSimpleName() + " being ticked." );
tt.addEntityCrashInfo( crashreportcategory );
throw new ReportedException( crashreport );
}
}
private void addToQueue( TickTracker tt )
private void addToQueue( final TickTracker tt )
{
tt.lastTick = this.currentTick;
this.upcomingTicks.add( tt );
}
@Override
public void removeNode( IGridNode gridNode, IGridHost machine )
public void removeNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof IGridTickable )
{
@@ -151,14 +151,14 @@ public class TickManagerCache implements ITickManager
}
@Override
public void addNode( IGridNode gridNode, IGridHost machine )
public void addNode( final IGridNode gridNode, final IGridHost machine )
{
if( machine instanceof IGridTickable )
{
TickingRequest tr = ( (IGridTickable) machine ).getTickingRequest( gridNode );
final TickingRequest tr = ( (IGridTickable) machine ).getTickingRequest( gridNode );
if( tr != null )
{
TickTracker tt = new TickTracker( tr, gridNode, (IGridTickable) machine, this.currentTick, this );
final TickTracker tt = new TickTracker( tr, gridNode, (IGridTickable) machine, this.currentTick, this );
if( tr.canBeAlerted )
{
@@ -179,27 +179,27 @@ public class TickManagerCache implements ITickManager
}
@Override
public void onSplit( IGridStorage storageB )
public void onSplit( final IGridStorage storageB )
{
}
@Override
public void onJoin( IGridStorage storageB )
public void onJoin( final IGridStorage storageB )
{
}
@Override
public void populateGridStorage( IGridStorage storage )
public void populateGridStorage( final IGridStorage storage )
{
}
@Override
public boolean alertDevice( IGridNode node )
public boolean alertDevice( final IGridNode node )
{
TickTracker tt = this.alertable.get( node );
final TickTracker tt = this.alertable.get( node );
if( tt == null )
{
return false;
@@ -223,11 +223,11 @@ public class TickManagerCache implements ITickManager
}
@Override
public boolean sleepDevice( IGridNode node )
public boolean sleepDevice( final IGridNode node )
{
if( this.awake.containsKey( node ) )
{
TickTracker gt = this.awake.get( node );
final TickTracker gt = this.awake.get( node );
this.awake.remove( node );
this.sleeping.put( node, gt );
@@ -238,11 +238,11 @@ public class TickManagerCache implements ITickManager
}
@Override
public boolean wakeDevice( IGridNode node )
public boolean wakeDevice( final IGridNode node )
{
if( this.sleeping.containsKey( node ) )
{
TickTracker gt = this.sleeping.get( node );
final TickTracker gt = this.sleeping.get( node );
this.sleeping.remove( node );
this.awake.put( node, gt );
this.addToQueue( gt );
@@ -27,7 +27,7 @@ public class ConnectionWrapper
public IGridConnection connection;
public ConnectionWrapper( IGridConnection gc )
public ConnectionWrapper( final IGridConnection gc )
{
this.connection = gc;
}
+2 -2
View File
@@ -36,13 +36,13 @@ public class Connections implements IWorldCallable<Void>
public boolean create = false;
public boolean destroy = false;
public Connections( PartP2PTunnelME o )
public Connections( final PartP2PTunnelME o )
{
this.me = o;
}
@Override
public Void call( World world ) throws Exception
public Void call( final World world ) throws Exception
{
this.me.updateConnections( this );
+8 -8
View File
@@ -43,7 +43,7 @@ public class TickTracker implements Comparable<TickTracker>
public long lastTick;
public int current_rate;
public TickTracker( TickingRequest req, IGridNode node, IGridTickable gt, long currentTick, TickManagerCache tickManagerCache )
public TickTracker( final TickingRequest req, final IGridNode node, final IGridTickable gt, final long currentTick, final TickManagerCache tickManagerCache )
{
this.request = req;
this.gt = gt;
@@ -58,7 +58,7 @@ public class TickTracker implements Comparable<TickTracker>
return ( this.LastFiveTicksTime / 5 );
}
public void setRate( int rate )
public void setRate( final int rate )
{
this.current_rate = rate;
@@ -74,18 +74,18 @@ public class TickTracker implements Comparable<TickTracker>
}
@Override
public int compareTo( @Nonnull TickTracker t )
public int compareTo( @Nonnull final TickTracker t )
{
int nextTick = (int) ( ( this.lastTick - this.host.getCurrentTick() ) + this.current_rate );
int ts_nextTick = (int) ( ( t.lastTick - this.host.getCurrentTick() ) + t.current_rate );
final int nextTick = (int) ( ( this.lastTick - this.host.getCurrentTick() ) + this.current_rate );
final int ts_nextTick = (int) ( ( t.lastTick - this.host.getCurrentTick() ) + t.current_rate );
return nextTick - ts_nextTick;
}
public void addEntityCrashInfo( CrashReportCategory crashreportcategory )
public void addEntityCrashInfo( final CrashReportCategory crashreportcategory )
{
if( this.gt instanceof AEBasePart )
{
AEBasePart part = (AEBasePart) this.gt;
final AEBasePart part = (AEBasePart) this.gt;
part.addEntityCrashInfo( crashreportcategory );
}
@@ -96,7 +96,7 @@ public class TickTracker implements Comparable<TickTracker>
crashreportcategory.addCrashSection( "GridBlockType", this.node.getGridBlock().getClass().getName() );
crashreportcategory.addCrashSection( "ConnectedSides", this.node.getConnectedSides() );
DimensionalCoord dc = this.node.getGridBlock().getLocation();
final DimensionalCoord dc = this.node.getGridBlock().getLocation();
if( dc != null )
{
crashreportcategory.addCrashSection( "Location", dc );
@@ -32,13 +32,13 @@ public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
final Class clz;
Collection<T> tunnelSources;
public TunnelCollection( Collection<T> src, Class c )
public TunnelCollection( final Collection<T> src, final Class c )
{
this.tunnelSources = src;
this.clz = c;
}
public void setSource( Collection<T> c )
public void setSource( final Collection<T> c )
{
this.tunnelSources = c;
}
@@ -58,7 +58,7 @@ public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
return new TunnelIterator<T>( this.tunnelSources, this.clz );
}
public boolean matches( Class<? extends PartP2PTunnel> c )
public boolean matches( final Class<? extends PartP2PTunnel> c )
{
return this.clz == c;
}
@@ -29,7 +29,7 @@ public class TunnelConnection
public final PartP2PTunnelME tunnel;
public final IGridConnection c;
public TunnelConnection( PartP2PTunnelME t, IGridConnection con )
public TunnelConnection( final PartP2PTunnelME t, final IGridConnection con )
{
this.tunnel = t;
this.c = con;
+2 -2
View File
@@ -32,7 +32,7 @@ public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
final Class targetType;
T Next;
public TunnelIterator( Collection<T> tunnelSources, Class clz )
public TunnelIterator( final Collection<T> tunnelSources, final Class clz )
{
this.wrapped = tunnelSources.iterator();
this.targetType = clz;
@@ -61,7 +61,7 @@ public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
@Override
public T next()
{
T tmp = this.Next;
final T tmp = this.Next;
this.Next = null;
return tmp;
}
@@ -33,12 +33,12 @@ public abstract class MBCalculator
private final IAEMultiBlock target;
public MBCalculator( IAEMultiBlock t )
public MBCalculator( final IAEMultiBlock t )
{
this.target = t;
}
public void calculateMultiblock( World world, WorldCoord loc )
public void calculateMultiblock( final World world, final WorldCoord loc )
{
if( Platform.isClient() )
{
@@ -47,8 +47,8 @@ public abstract class MBCalculator
try
{
WorldCoord min = loc.copy();
WorldCoord max = loc.copy();
final WorldCoord min = loc.copy();
final WorldCoord max = loc.copy();
// find size of MB structure...
while( this.isValidTileAt( world, min.x - 1, min.y, min.z ) )
@@ -90,14 +90,14 @@ public abstract class MBCalculator
return;
}
}
catch( Exception err )
catch( final Exception err )
{
this.disconnect();
return;
}
boolean updateGrid = false;
IAECluster cluster = this.target.getCluster();
final IAECluster cluster = this.target.getCluster();
if( cluster == null )
{
this.updateTiles( c, world, min, max );
@@ -114,7 +114,7 @@ public abstract class MBCalculator
}
}
}
catch( Throwable err )
catch( final Throwable err )
{
AELog.error( err );
}
@@ -122,7 +122,7 @@ public abstract class MBCalculator
this.disconnect();
}
public boolean isValidTileAt( World w, int x, int y, int z )
public boolean isValidTileAt( final World w, final int x, final int y, final int z )
{
return this.isValidTile( w.getTileEntity( new BlockPos( x, y, z ) ) );
}
@@ -137,9 +137,9 @@ public abstract class MBCalculator
*/
public abstract boolean checkMultiblockScale( WorldCoord min, WorldCoord max );
public boolean verifyUnownedRegion( World w, WorldCoord min, WorldCoord max )
public boolean verifyUnownedRegion( final World w, final WorldCoord min, final WorldCoord max )
{
for( AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
for( final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
{
if( this.verifyUnownedRegionInner( w, min.x, min.y, min.z, max.x, max.y, max.z, side ) )
{
@@ -187,7 +187,7 @@ public abstract class MBCalculator
*/
public abstract boolean isValidTile( TileEntity te );
public boolean verifyUnownedRegionInner( World w, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, AEPartLocation side )
public boolean verifyUnownedRegionInner( final World w, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, final AEPartLocation side )
{
switch( side )
{
@@ -225,7 +225,7 @@ public abstract class MBCalculator
{
for( int z = minZ; z <= maxZ; z++ )
{
TileEntity te = w.getTileEntity( new BlockPos( x, y, z ) );
final TileEntity te = w.getTileEntity( new BlockPos( x, y, z ) );
if( this.isValidTile( te ) )
{
return true;
@@ -41,14 +41,14 @@ public class CraftingCPUCalculator extends MBCalculator
final TileCraftingTile tqb;
public CraftingCPUCalculator( IAEMultiBlock t )
public CraftingCPUCalculator( final IAEMultiBlock t )
{
super( t );
this.tqb = (TileCraftingTile) t;
}
@Override
public boolean checkMultiblockScale( WorldCoord min, WorldCoord max )
public boolean checkMultiblockScale( final WorldCoord min, final WorldCoord max )
{
if( max.x - min.x > 16 )
{
@@ -69,13 +69,13 @@ public class CraftingCPUCalculator extends MBCalculator
}
@Override
public IAECluster createCluster( World w, WorldCoord min, WorldCoord max )
public IAECluster createCluster( final World w, final WorldCoord min, final WorldCoord max )
{
return new CraftingCPUCluster( min, max );
}
@Override
public boolean verifyInternalStructure( World w, WorldCoord min, WorldCoord max )
public boolean verifyInternalStructure( final World w, final WorldCoord min, final WorldCoord max )
{
boolean storage = false;
@@ -85,7 +85,7 @@ public class CraftingCPUCalculator extends MBCalculator
{
for( int z = min.z; z <= max.z; z++ )
{
IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( new BlockPos( x, y, z ) );
final IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( new BlockPos( x, y, z ) );
if( !te.isValid() )
{
@@ -110,9 +110,9 @@ public class CraftingCPUCalculator extends MBCalculator
}
@Override
public void updateTiles( IAECluster cl, World w, WorldCoord min, WorldCoord max )
public void updateTiles( final IAECluster cl, final World w, final WorldCoord min, final WorldCoord max )
{
CraftingCPUCluster c = (CraftingCPUCluster) cl;
final CraftingCPUCluster c = (CraftingCPUCluster) cl;
for( int x = min.x; x <= max.x; x++ )
{
@@ -120,7 +120,7 @@ public class CraftingCPUCalculator extends MBCalculator
{
for( int z = min.z; z <= max.z; z++ )
{
TileCraftingTile te = (TileCraftingTile) w.getTileEntity( new BlockPos( x, y, z ) );
final TileCraftingTile te = (TileCraftingTile) w.getTileEntity( new BlockPos( x, y, z ) );
te.updateStatus( c );
c.addTile( te );
}
@@ -129,14 +129,14 @@ public class CraftingCPUCalculator extends MBCalculator
c.done();
Iterator<IGridHost> i = c.getTiles();
final Iterator<IGridHost> i = c.getTiles();
while( i.hasNext() )
{
IGridHost gh = i.next();
IGridNode n = gh.getGridNode( AEPartLocation.INTERNAL );
final IGridHost gh = i.next();
final IGridNode n = gh.getGridNode( AEPartLocation.INTERNAL );
if( n != null )
{
IGrid g = n.getGrid();
final IGrid g = n.getGrid();
if( g != null )
{
g.postEvent( new MENetworkCraftingCpuChange( n ) );
@@ -147,7 +147,7 @@ public class CraftingCPUCalculator extends MBCalculator
}
@Override
public boolean isValidTile( TileEntity te )
public boolean isValidTile( final TileEntity te )
{
return te instanceof TileCraftingTile;
}
@@ -112,7 +112,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
private long startItemCount;
private long remainingItemCount;
public CraftingCPUCluster( WorldCoord min, WorldCoord max )
public CraftingCPUCluster( final WorldCoord min, final WorldCoord max )
{
this.min = min;
this.max = max;
@@ -132,7 +132,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
* add a new Listener to the monitor, be sure to properly remove yourself when your done.
*/
@Override
public void addListener( IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken )
public void addListener( final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken )
{
this.listeners.put( l, verificationToken );
}
@@ -141,7 +141,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
* remove a Listener to the monitor.
*/
@Override
public void removeListener( IMEMonitorHandlerReceiver<IAEItemStack> l )
public void removeListener( final IMEMonitorHandlerReceiver<IAEItemStack> l )
{
this.listeners.remove( l );
}
@@ -152,9 +152,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
@Override
public void updateStatus( boolean updateGrid )
public void updateStatus( final boolean updateGrid )
{
for( TileCraftingTile r : this.tiles )
for( final TileCraftingTile r : this.tiles )
{
r.updateMeta( true );
}
@@ -171,7 +171,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
boolean posted = false;
for( TileCraftingTile r : this.tiles )
for( final TileCraftingTile r : this.tiles )
{
final IGridNode n = r.getActionableNode();
if( n != null && !posted )
@@ -194,7 +194,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return (Iterator) this.tiles.iterator();
}
public void addTile( TileCraftingTile te )
public void addTile( final TileCraftingTile te )
{
if( this.machineSrc == null || te.isCoreBlock )
{
@@ -220,7 +220,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
public boolean canAccept( IAEStack input )
public boolean canAccept( final IAEStack input )
{
if( input instanceof IAEItemStack )
{
@@ -233,7 +233,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return false;
}
public IAEStack injectItems( IAEStack input, Actionable type, BaseActionSource src )
public IAEStack injectItems( final IAEStack input, final Actionable type, final BaseActionSource src )
{
if( !( input instanceof IAEItemStack ) )
{
@@ -362,7 +362,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return input;
}
protected void postChange( IAEItemStack diff, BaseActionSource src )
protected void postChange( final IAEItemStack diff, final BaseActionSource src )
{
final Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.getListeners();
@@ -394,7 +394,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.getCore().markDirty();
}
public void postCraftingStatusChange( IAEItemStack diff )
public void postCraftingStatusChange( final IAEItemStack diff )
{
if( this.getGrid() == null )
{
@@ -409,7 +409,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( !list.isEmpty() )
{
for( CraftingWatcher iw : list )
for( final CraftingWatcher iw : list )
{
iw.getHost().onRequestChange( sg, diff );
@@ -442,7 +442,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
send = null;
}
for( TileCraftingMonitorTile t : this.status )
for( final TileCraftingMonitorTile t : this.status )
{
t.setJob( send );
}
@@ -460,7 +460,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public IGrid getGrid()
{
for( TileCraftingTile r : this.tiles )
for( final TileCraftingTile r : this.tiles )
{
final IGridNode gn = r.getActionableNode();
if( gn != null )
@@ -476,7 +476,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return null;
}
private boolean canCraft( ICraftingPatternDetails details, IAEItemStack[] condensedInputs )
private boolean canCraft( final ICraftingPatternDetails details, final IAEItemStack[] condensedInputs )
{
for( IAEItemStack g : condensedInputs )
{
@@ -531,9 +531,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.myLastLink.cancel();
}
IItemList<IAEItemStack> list;
final IItemList<IAEItemStack> list;
this.getListOfItem( list = AEApi.instance().storage().createItemList(), CraftingItemList.ALL );
for( IAEItemStack is : list )
for( final IAEItemStack is : list )
{
this.postChange( is, this.machineSrc );
}
@@ -546,7 +546,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.waitingFor.resetStatus();
for( IAEItemStack is : items )
for( final IAEItemStack is : items )
{
this.postCraftingStatusChange( is );
}
@@ -557,7 +557,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.storeItems(); // marks dirty
}
public void updateCraftingLogic( IGrid grid, IEnergyGrid eg, CraftingGridCache cc )
public void updateCraftingLogic( final IGrid grid, final IEnergyGrid eg, final CraftingGridCache cc )
{
if( !this.getCore().isActive() )
{
@@ -612,7 +612,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
private void executeCrafting( IEnergyGrid eg, CraftingGridCache cc )
private void executeCrafting( final IEnergyGrid eg, final CraftingGridCache cc )
{
final Iterator<Entry<ICraftingPatternDetails, TaskProgress>> i = this.tasks.entrySet().iterator();
@@ -632,7 +632,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
{
InventoryCrafting ic = null;
for( ICraftingMedium m : cc.getMediums( e.getKey() ) )
for( final ICraftingMedium m : cc.getMediums( e.getKey() ) )
{
if( e.getValue().value <= 0 )
{
@@ -646,7 +646,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
final IAEItemStack[] input = details.getInputs();
double sum = 0;
for( IAEItemStack anInput : input )
for( final IAEItemStack anInput : input )
{
if( anInput != null )
{
@@ -736,7 +736,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.somethingChanged = true;
this.remainingOperations--;
for( IAEItemStack out : details.getCondensedOutputs() )
for( final IAEItemStack out : details.getCondensedOutputs() )
{
this.postChange( out, this.machineSrc );
this.waitingFor.add( out.copy() );
@@ -829,7 +829,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.markDirty();
}
public ICraftingLink submitJob( IGrid g, ICraftingJob job, BaseActionSource src, ICraftingRequester requestingMachine )
public ICraftingLink submitJob( final IGrid g, final ICraftingJob job, final BaseActionSource src, final ICraftingRequester requestingMachine )
{
if( !this.tasks.isEmpty() || !this.waitingFor.isEmpty() )
{
@@ -880,7 +880,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
this.getListOfItem( list, CraftingItemList.ALL );
for( IAEItemStack ge : list )
for( final IAEItemStack ge : list )
{
this.postChange( ge, this.machineSrc );
}
@@ -893,7 +893,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.inventory.getItemList().resetStatus();
}
}
catch( CraftBranchFailure e )
catch( final CraftBranchFailure e )
{
this.tasks.clear();
this.inventory.getItemList().resetStatus();
@@ -970,7 +970,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return Long.toString( now, Character.MAX_RADIX ) + '-' + Integer.toString( hash, Character.MAX_RADIX ) + '-' + Integer.toString( hmm, Character.MAX_RADIX );
}
private NBTTagCompound generateLinkData( String craftingID, boolean standalone, boolean req )
private NBTTagCompound generateLinkData( final String craftingID, final boolean standalone, final boolean req )
{
final NBTTagCompound tag = new NBTTagCompound();
@@ -983,7 +983,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return tag;
}
private void submitLink( ICraftingLink myLastLink2 )
private void submitLink( final ICraftingLink myLastLink2 )
{
if( this.getGrid() != null )
{
@@ -992,18 +992,18 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
public void getListOfItem( IItemList<IAEItemStack> list, CraftingItemList whichList )
public void getListOfItem( final IItemList<IAEItemStack> list, final CraftingItemList whichList )
{
switch( whichList )
{
case ACTIVE:
for( IAEItemStack ais : this.waitingFor )
for( final IAEItemStack ais : this.waitingFor )
{
list.add( ais );
}
break;
case PENDING:
for( Entry<ICraftingPatternDetails, TaskProgress> t : this.tasks.entrySet() )
for( final Entry<ICraftingPatternDetails, TaskProgress> t : this.tasks.entrySet() )
{
for( IAEItemStack ais : t.getKey().getCondensedOutputs() )
{
@@ -1020,12 +1020,12 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
case ALL:
this.inventory.getAvailableItems( list );
for( IAEItemStack ais : this.waitingFor )
for( final IAEItemStack ais : this.waitingFor )
{
list.add( ais );
}
for( Entry<ICraftingPatternDetails, TaskProgress> t : this.tasks.entrySet() )
for( final Entry<ICraftingPatternDetails, TaskProgress> t : this.tasks.entrySet() )
{
for( IAEItemStack ais : t.getKey().getCondensedOutputs() )
{
@@ -1038,18 +1038,18 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
public void addStorage( IAEItemStack extractItems )
public void addStorage( final IAEItemStack extractItems )
{
this.inventory.injectItems( extractItems, Actionable.MODULATE, null );
}
public void addEmitable( IAEItemStack i )
public void addEmitable( final IAEItemStack i )
{
this.waitingFor.add( i );
this.postCraftingStatusChange( i );
}
public void addCrafting( ICraftingPatternDetails details, long crafts )
public void addCrafting( final ICraftingPatternDetails details, final long crafts )
{
TaskProgress i = this.tasks.get( details );
@@ -1061,7 +1061,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
i.value += crafts;
}
public IAEItemStack getItemStack( IAEItemStack what, CraftingItemList storage2 )
public IAEItemStack getItemStack( final IAEItemStack what, final CraftingItemList storage2 )
{
IAEItemStack is;
@@ -1078,9 +1078,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
is = what.copy();
is.setStackSize( 0 );
for( Entry<ICraftingPatternDetails, TaskProgress> t : this.tasks.entrySet() )
for( final Entry<ICraftingPatternDetails, TaskProgress> t : this.tasks.entrySet() )
{
for( IAEItemStack ais : t.getKey().getCondensedOutputs() )
for( final IAEItemStack ais : t.getKey().getCondensedOutputs() )
{
if( ais.equals( is ) )
{
@@ -1105,7 +1105,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return is;
}
public void writeToNBT( NBTTagCompound data )
public void writeToNBT( final NBTTagCompound data )
{
data.setTag( "finalOutput", this.writeItem( this.finalOutput ) );
data.setTag( "inventory", this.writeList( this.inventory.getItemList() ) );
@@ -1120,7 +1120,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
final NBTTagList list = new NBTTagList();
for( Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
{
final NBTTagCompound item = this.writeItem( AEItemStack.create( e.getKey().getPattern() ) );
item.setLong( "craftingProgress", e.getValue().value );
@@ -1135,7 +1135,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
data.setLong( "remainingItemCount", this.getRemainingItemCount() );
}
private NBTTagCompound writeItem( IAEItemStack finalOutput2 )
private NBTTagCompound writeItem( final IAEItemStack finalOutput2 )
{
final NBTTagCompound out = new NBTTagCompound();
@@ -1147,11 +1147,11 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return out;
}
private NBTTagList writeList( IItemList<IAEItemStack> myList )
private NBTTagList writeList( final IItemList<IAEItemStack> myList )
{
final NBTTagList out = new NBTTagList();
for( IAEItemStack ais : myList )
for( final IAEItemStack ais : myList )
{
out.appendTag( this.writeItem( ais ) );
}
@@ -1175,10 +1175,10 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.updateName();
}
public void readFromNBT( NBTTagCompound data )
public void readFromNBT( final NBTTagCompound data )
{
this.finalOutput = AEItemStack.loadItemStackFromNBT( (NBTTagCompound) data.getTag( "finalOutput" ) );
for( IAEItemStack ais : this.readList( (NBTTagList) data.getTag( "inventory" ) ) )
for( final IAEItemStack ais : this.readList( (NBTTagList) data.getTag( "inventory" ) ) )
{
this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc );
}
@@ -1212,7 +1212,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
this.waitingFor = this.readList( (NBTTagList) data.getTag( "waitingFor" ) );
for( IAEItemStack is : this.waitingFor )
for( final IAEItemStack is : this.waitingFor )
{
this.postCraftingStatusChange( is.copy() );
}
@@ -1226,7 +1226,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public void updateName()
{
this.myName = "";
for( TileCraftingTile te : this.tiles )
for( final TileCraftingTile te : this.tiles )
{
if( te.hasCustomName() )
@@ -1243,7 +1243,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
private IItemList<IAEItemStack> readList( NBTTagList tag )
private IItemList<IAEItemStack> readList( final NBTTagList tag )
{
final IItemList<IAEItemStack> out = AEApi.instance().storage().createItemList();
@@ -1269,7 +1269,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return this.getCore().getWorld();
}
public boolean isMaking( IAEItemStack what )
public boolean isMaking( final IAEItemStack what )
{
final IAEItemStack wat = this.waitingFor.findPrecise( what );
return wat != null && wat.getStackSize() > 0;
@@ -1296,7 +1296,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.getListOfItem( list, CraftingItemList.PENDING );
int itemCount = 0;
for( IAEItemStack ge : list )
for( final IAEItemStack ge : list )
{
itemCount += ge.getStackSize();
}
@@ -1305,7 +1305,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.remainingItemCount = itemCount;
}
private void updateElapsedTime( IAEItemStack is )
private void updateElapsedTime( final IAEItemStack is )
{
final long nextStartTime = System.nanoTime();
this.elapsedTime = this.getElapsedTime() + nextStartTime - lastTime;
@@ -39,21 +39,21 @@ public class QuantumCalculator extends MBCalculator
private final TileQuantumBridge tqb;
public QuantumCalculator( IAEMultiBlock t )
public QuantumCalculator( final IAEMultiBlock t )
{
super( t );
this.tqb = (TileQuantumBridge) t;
}
@Override
public boolean checkMultiblockScale( WorldCoord min, WorldCoord max )
public boolean checkMultiblockScale( final WorldCoord min, final WorldCoord max )
{
if( ( max.x - min.x + 1 ) * ( max.y - min.y + 1 ) * ( max.z - min.z + 1 ) == 9 )
{
int ones = ( ( max.x - min.x ) == 0 ? 1 : 0 ) + ( ( max.y - min.y ) == 0 ? 1 : 0 ) + ( ( max.z - min.z ) == 0 ? 1 : 0 );
final int ones = ( ( max.x - min.x ) == 0 ? 1 : 0 ) + ( ( max.y - min.y ) == 0 ? 1 : 0 ) + ( ( max.z - min.z ) == 0 ? 1 : 0 );
int threes = ( ( max.x - min.x ) == 2 ? 1 : 0 ) + ( ( max.y - min.y ) == 2 ? 1 : 0 ) + ( ( max.z - min.z ) == 2 ? 1 : 0 );
final int threes = ( ( max.x - min.x ) == 2 ? 1 : 0 ) + ( ( max.y - min.y ) == 2 ? 1 : 0 ) + ( ( max.z - min.z ) == 2 ? 1 : 0 );
return ones == 1 && threes == 2;
}
@@ -61,13 +61,13 @@ public class QuantumCalculator extends MBCalculator
}
@Override
public IAECluster createCluster( World w, WorldCoord min, WorldCoord max )
public IAECluster createCluster( final World w, final WorldCoord min, final WorldCoord max )
{
return new QuantumCluster( min, max );
}
@Override
public boolean verifyInternalStructure( World w, WorldCoord min, WorldCoord max )
public boolean verifyInternalStructure( final World w, final WorldCoord min, final WorldCoord max )
{
byte num = 0;
@@ -78,8 +78,8 @@ public class QuantumCalculator extends MBCalculator
{
for( int z = min.z; z <= max.z; z++ )
{
BlockPos p = new BlockPos( x, y, z );
IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( p );
final BlockPos p = new BlockPos( x, y, z );
final IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( p );
if( !te.isValid() )
{
@@ -115,11 +115,11 @@ public class QuantumCalculator extends MBCalculator
}
@Override
public void updateTiles( IAECluster cl, World w, WorldCoord min, WorldCoord max )
public void updateTiles( final IAECluster cl, final World w, final WorldCoord min, final WorldCoord max )
{
byte num = 0;
byte ringNum = 0;
QuantumCluster c = (QuantumCluster) cl;
final QuantumCluster c = (QuantumCluster) cl;
for( int x = min.x; x <= max.x; x++ )
{
@@ -127,10 +127,10 @@ public class QuantumCalculator extends MBCalculator
{
for( int z = min.z; z <= max.z; z++ )
{
TileQuantumBridge te = (TileQuantumBridge) w.getTileEntity( new BlockPos( x, y, z ) );
final TileQuantumBridge te = (TileQuantumBridge) w.getTileEntity( new BlockPos( x, y, z ) );
num++;
byte flags;
final byte flags;
if( num == 5 )
{
flags = num;
@@ -157,14 +157,14 @@ public class QuantumCalculator extends MBCalculator
}
@Override
public boolean isValidTile( TileEntity te )
public boolean isValidTile( final TileEntity te )
{
return te instanceof TileQuantumBridge;
}
private boolean isBlockAtLocation( IBlockAccess w, BlockPos pos, IBlockDefinition def )
private boolean isBlockAtLocation( final IBlockAccess w, final BlockPos pos, final IBlockDefinition def )
{
for( Block block : def.maybeBlock().asSet() )
for( final Block block : def.maybeBlock().asSet() )
{
return block == w.getBlockState( pos ).getBlock();
}
@@ -57,7 +57,7 @@ public class QuantumCluster implements ILocatable, IAECluster
private long otherSide;
private TileQuantumBridge center;
public QuantumCluster( WorldCoord min, WorldCoord max )
public QuantumCluster( final WorldCoord min, final WorldCoord max )
{
this.min = min;
this.max = max;
@@ -65,7 +65,7 @@ public class QuantumCluster implements ILocatable, IAECluster
}
@SubscribeEvent
public void onUnload( WorldEvent.Unload e )
public void onUnload( final WorldEvent.Unload e )
{
if( this.center.getWorld() == e.world )
{
@@ -75,10 +75,10 @@ public class QuantumCluster implements ILocatable, IAECluster
}
@Override
public void updateStatus( boolean updateGrid )
public void updateStatus( final boolean updateGrid )
{
long qe = this.center.getQEFrequency();
final long qe = this.center.getQEFrequency();
if( this.thisSide != qe && this.thisSide != -qe )
{
@@ -111,23 +111,23 @@ public class QuantumCluster implements ILocatable, IAECluster
}
}
ILocatable myOtherSide = this.otherSide == 0 ? null : AEApi.instance().registries().locatable().getLocatableBy( this.otherSide );
final ILocatable myOtherSide = this.otherSide == 0 ? null : AEApi.instance().registries().locatable().getLocatableBy( this.otherSide );
boolean shutdown = false;
if( myOtherSide instanceof QuantumCluster )
{
QuantumCluster sideA = this;
QuantumCluster sideB = (QuantumCluster) myOtherSide;
final QuantumCluster sideA = this;
final QuantumCluster sideB = (QuantumCluster) myOtherSide;
if( sideA.isActive() && sideB.isActive() )
{
if( this.connection != null && this.connection.connection != null )
{
IGridNode a = this.connection.connection.a();
IGridNode b = this.connection.connection.b();
IGridNode sa = sideA.getNode();
IGridNode sb = sideB.getNode();
final IGridNode a = this.connection.connection.a();
final IGridNode b = this.connection.connection.b();
final IGridNode sa = sideA.getNode();
final IGridNode sb = sideB.getNode();
if( ( a == sa || b == sa ) && ( a == sb || b == sb ) )
{
return;
@@ -156,7 +156,7 @@ public class QuantumCluster implements ILocatable, IAECluster
sideA.connection = sideB.connection = new ConnectionWrapper( AEApi.instance().createGridConnection( sideA.getNode(), sideB.getNode() ) );
}
catch( FailedConnection e )
catch( final FailedConnection e )
{
// :(
}
@@ -182,21 +182,21 @@ public class QuantumCluster implements ILocatable, IAECluster
}
}
public boolean canUseNode( long qe )
public boolean canUseNode( final long qe )
{
QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
if( qc != null )
{
World theWorld = qc.center.getWorld();
final World theWorld = qc.center.getWorld();
if( !qc.isDestroyed )
{
Chunk c = theWorld.getChunkFromBlockCoords( qc.center.getPos() );
final Chunk c = theWorld.getChunkFromBlockCoords( qc.center.getPos() );
if( c.isLoaded() )
{
int id = theWorld.provider.getDimensionId();
World cur = DimensionManager.getWorld( id );
final int id = theWorld.provider.getDimensionId();
final World cur = DimensionManager.getWorld( id );
TileEntity te = theWorld.getTileEntity( qc.center.getPos() );
final TileEntity te = theWorld.getTileEntity( qc.center.getPos() );
return te != qc.center || theWorld != cur;
}
}
@@ -247,7 +247,7 @@ public class QuantumCluster implements ILocatable, IAECluster
this.center.updateStatus( null, (byte) -1, this.updateStatus );
for( TileQuantumBridge r : this.Ring )
for( final TileQuantumBridge r : this.Ring )
{
r.updateStatus( null, (byte) -1, this.updateStatus );
}
@@ -262,7 +262,7 @@ public class QuantumCluster implements ILocatable, IAECluster
return new ChainedIterator<IGridHost>( this.Ring[0], this.Ring[1], this.Ring[2], this.Ring[3], this.Ring[4], this.Ring[5], this.Ring[6], this.Ring[7], this.center );
}
public boolean isCorner( TileQuantumBridge tileQuantumBridge )
public boolean isCorner( final TileQuantumBridge tileQuantumBridge )
{
return this.Ring[0] == tileQuantumBridge || this.Ring[2] == tileQuantumBridge || this.Ring[4] == tileQuantumBridge || this.Ring[6] == tileQuantumBridge;
}
@@ -278,7 +278,7 @@ public class QuantumCluster implements ILocatable, IAECluster
return this.center;
}
public void setCenter( TileQuantumBridge c )
public void setCenter( final TileQuantumBridge c )
{
this.registered = true;
MinecraftForge.EVENT_BUS.register( this );
@@ -35,26 +35,26 @@ public class SpatialPylonCalculator extends MBCalculator
private final TileSpatialPylon tqb;
public SpatialPylonCalculator( IAEMultiBlock t )
public SpatialPylonCalculator( final IAEMultiBlock t )
{
super( t );
this.tqb = (TileSpatialPylon) t;
}
@Override
public boolean checkMultiblockScale( WorldCoord min, WorldCoord max )
public boolean checkMultiblockScale( final WorldCoord min, final WorldCoord max )
{
return ( min.x == max.x && min.y == max.y && min.z != max.z ) || ( min.x == max.x && min.y != max.y && min.z == max.z ) || ( min.x != max.x && min.y == max.y && min.z == max.z );
}
@Override
public IAECluster createCluster( World w, WorldCoord min, WorldCoord max )
public IAECluster createCluster( final World w, final WorldCoord min, final WorldCoord max )
{
return new SpatialPylonCluster( new DimensionalCoord( w, min.x, min.y, min.z ), new DimensionalCoord( w, max.x, max.y, max.z ) );
}
@Override
public boolean verifyInternalStructure( World w, WorldCoord min, WorldCoord max )
public boolean verifyInternalStructure( final World w, final WorldCoord min, final WorldCoord max )
{
for( int x = min.x; x <= max.x; x++ )
@@ -63,7 +63,7 @@ public class SpatialPylonCalculator extends MBCalculator
{
for( int z = min.z; z <= max.z; z++ )
{
IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( new BlockPos( x, y, z ) );
final IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( new BlockPos( x, y, z ) );
if( !te.isValid() )
{
@@ -83,9 +83,9 @@ public class SpatialPylonCalculator extends MBCalculator
}
@Override
public void updateTiles( IAECluster cl, World w, WorldCoord min, WorldCoord max )
public void updateTiles( final IAECluster cl, final World w, final WorldCoord min, final WorldCoord max )
{
SpatialPylonCluster c = (SpatialPylonCluster) cl;
final SpatialPylonCluster c = (SpatialPylonCluster) cl;
for( int x = min.x; x <= max.x; x++ )
{
@@ -93,7 +93,7 @@ public class SpatialPylonCalculator extends MBCalculator
{
for( int z = min.z; z <= max.z; z++ )
{
TileSpatialPylon te = (TileSpatialPylon) w.getTileEntity( new BlockPos( x, y, z ) );
final TileSpatialPylon te = (TileSpatialPylon) w.getTileEntity( new BlockPos( x, y, z ) );
te.updateStatus( c );
c.line.add( ( te ) );
}
@@ -102,7 +102,7 @@ public class SpatialPylonCalculator extends MBCalculator
}
@Override
public boolean isValidTile( TileEntity te )
public boolean isValidTile( final TileEntity te )
{
return te instanceof TileSpatialPylon;
}
@@ -42,7 +42,7 @@ public class SpatialPylonCluster implements IAECluster
public boolean hasPower;
public boolean hasChannel;
public SpatialPylonCluster( DimensionalCoord min, DimensionalCoord max )
public SpatialPylonCluster( final DimensionalCoord min, final DimensionalCoord max )
{
this.min = min.copy();
this.max = max.copy();
@@ -66,9 +66,9 @@ public class SpatialPylonCluster implements IAECluster
}
@Override
public void updateStatus( boolean updateGrid )
public void updateStatus( final boolean updateGrid )
{
for( TileSpatialPylon r : this.line )
for( final TileSpatialPylon r : this.line )
{
r.recalculateDisplay();
}
@@ -84,7 +84,7 @@ public class SpatialPylonCluster implements IAECluster
}
this.isDestroyed = true;
for( TileSpatialPylon r : this.line )
for( final TileSpatialPylon r : this.line )
{
r.updateStatus( null );
}
@@ -30,7 +30,7 @@ public class EnergyThreshold implements Comparable<EnergyThreshold>
public final IEnergyWatcher watcher;
final int hash;
public EnergyThreshold( double lim, IEnergyWatcher wat )
public EnergyThreshold( final double lim, final IEnergyWatcher wat )
{
this.Limit = lim;
this.watcher = wat;
@@ -52,7 +52,7 @@ public class EnergyThreshold implements Comparable<EnergyThreshold>
}
@Override
public int compareTo( EnergyThreshold o )
public int compareTo( final EnergyThreshold o )
{
return ItemSorters.compareDouble( this.Limit, o.Limit );
}
@@ -38,13 +38,13 @@ public class EnergyWatcher implements IEnergyWatcher
final IEnergyWatcherHost myObject;
final HashSet<EnergyThreshold> myInterests = new HashSet<EnergyThreshold>();
public EnergyWatcher( EnergyGridCache cache, IEnergyWatcherHost host )
public EnergyWatcher( final EnergyGridCache cache, final IEnergyWatcherHost host )
{
this.gsc = cache;
this.myObject = host;
}
public void post( EnergyGridCache energyGridCache )
public void post( final EnergyGridCache energyGridCache )
{
this.myObject.onThresholdPass( energyGridCache );
}
@@ -67,7 +67,7 @@ public class EnergyWatcher implements IEnergyWatcher
}
@Override
public boolean contains( Object o )
public boolean contains( final Object o )
{
return this.myInterests.contains( o );
}
@@ -85,42 +85,42 @@ public class EnergyWatcher implements IEnergyWatcher
}
@Override
public <T> T[] toArray( T[] a )
public <T> T[] toArray( final T[] a )
{
return this.myInterests.toArray( a );
}
@Override
public boolean add( Double e )
public boolean add( final Double e )
{
if( this.myInterests.contains( e ) )
{
return false;
}
EnergyThreshold eh = new EnergyThreshold( e, this );
final EnergyThreshold eh = new EnergyThreshold( e, this );
return this.gsc.interests.add( eh ) && this.myInterests.add( eh );
}
@Override
public boolean remove( Object o )
public boolean remove( final Object o )
{
EnergyThreshold eh = new EnergyThreshold( (Double) o, this );
final EnergyThreshold eh = new EnergyThreshold( (Double) o, this );
return this.myInterests.remove( eh ) && this.gsc.interests.remove( eh );
}
@Override
public boolean containsAll( Collection<?> c )
public boolean containsAll( final Collection<?> c )
{
return this.myInterests.containsAll( c );
}
@Override
public boolean addAll( Collection<? extends Double> c )
public boolean addAll( final Collection<? extends Double> c )
{
boolean didChange = false;
for( Double o : c )
for( final Double o : c )
{
didChange = this.add( o ) || didChange;
}
@@ -129,10 +129,10 @@ public class EnergyWatcher implements IEnergyWatcher
}
@Override
public boolean removeAll( Collection<?> c )
public boolean removeAll( final Collection<?> c )
{
boolean didSomething = false;
for( Object o : c )
for( final Object o : c )
{
didSomething = this.remove( o ) || didSomething;
}
@@ -140,10 +140,10 @@ public class EnergyWatcher implements IEnergyWatcher
}
@Override
public boolean retainAll( Collection<?> c )
public boolean retainAll( final Collection<?> c )
{
boolean changed = false;
Iterator<Double> i = this.iterator();
final Iterator<Double> i = this.iterator();
while( i.hasNext() )
{
@@ -160,7 +160,7 @@ public class EnergyWatcher implements IEnergyWatcher
@Override
public void clear()
{
Iterator<EnergyThreshold> i = this.myInterests.iterator();
final Iterator<EnergyThreshold> i = this.myInterests.iterator();
while( i.hasNext() )
{
this.gsc.interests.remove( i.next() );
@@ -175,7 +175,7 @@ public class EnergyWatcher implements IEnergyWatcher
final Iterator<EnergyThreshold> interestIterator;
EnergyThreshold myLast;
public EnergyWatcherIterator( EnergyWatcher parent, Iterator<EnergyThreshold> i )
public EnergyWatcherIterator( final EnergyWatcher parent, final Iterator<EnergyThreshold> i )
{
this.watcher = parent;
this.interestIterator = i;
@@ -70,7 +70,7 @@ public class AENetworkProxy implements IGridBlock
private double idleDraw = 1.0;
private EntityPlayer owner;
public AENetworkProxy( IGridProxyable te, String nbtName, ItemStack visual, boolean inWorld )
public AENetworkProxy( final IGridProxyable te, final String nbtName, final ItemStack visual, final boolean inWorld )
{
this.gp = te;
this.nbtName = nbtName;
@@ -79,12 +79,12 @@ public class AENetworkProxy implements IGridBlock
this.validSides = EnumSet.allOf( EnumFacing.class );
}
public void setVisualRepresentation( ItemStack is )
public void setVisualRepresentation( final ItemStack is )
{
this.myRepInstance = is;
}
public void writeToNBT( NBTTagCompound tag )
public void writeToNBT( final NBTTagCompound tag )
{
if( this.node != null )
{
@@ -92,7 +92,7 @@ public class AENetworkProxy implements IGridBlock
}
}
public void setValidSides( EnumSet<EnumFacing> validSides )
public void setValidSides( final EnumSet<EnumFacing> validSides )
{
this.validSides = validSides;
if( this.node != null )
@@ -132,7 +132,7 @@ public class AENetworkProxy implements IGridBlock
// send orientation based directionality to the node.
if( this.gp instanceof IOrientable )
{
IOrientable ori = (IOrientable) this.gp;
final IOrientable ori = (IOrientable) this.gp;
if( ori.canBeRotated() )
{
ori.setOrientation( ori.getForward(), ori.getUp() );
@@ -154,7 +154,7 @@ public class AENetworkProxy implements IGridBlock
return this.node;
}
public void readFromNBT( NBTTagCompound tag )
public void readFromNBT( final NBTTagCompound tag )
{
this.data = tag;
if( this.node != null && this.data != null )
@@ -174,12 +174,12 @@ public class AENetworkProxy implements IGridBlock
public IPathingGrid getPath() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
IPathingGrid pg = grid.getCache( IPathingGrid.class );
final IPathingGrid pg = grid.getCache( IPathingGrid.class );
if( pg == null )
{
throw new GridAccessException();
@@ -200,7 +200,7 @@ public class AENetworkProxy implements IGridBlock
{
throw new GridAccessException();
}
IGrid grid = this.node.getGrid();
final IGrid grid = this.node.getGrid();
if( grid == null )
{
throw new GridAccessException();
@@ -210,12 +210,12 @@ public class AENetworkProxy implements IGridBlock
public ITickManager getTick() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
ITickManager pg = grid.getCache( ITickManager.class );
final ITickManager pg = grid.getCache( ITickManager.class );
if( pg == null )
{
throw new GridAccessException();
@@ -225,13 +225,13 @@ public class AENetworkProxy implements IGridBlock
public IStorageGrid getStorage() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
IStorageGrid pg = grid.getCache( IStorageGrid.class );
final IStorageGrid pg = grid.getCache( IStorageGrid.class );
if( pg == null )
{
@@ -243,13 +243,13 @@ public class AENetworkProxy implements IGridBlock
public P2PCache getP2P() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
P2PCache pg = grid.getCache( P2PCache.class );
final P2PCache pg = grid.getCache( P2PCache.class );
if( pg == null )
{
@@ -261,13 +261,13 @@ public class AENetworkProxy implements IGridBlock
public ISecurityGrid getSecurity() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
ISecurityGrid sg = grid.getCache( ISecurityGrid.class );
final ISecurityGrid sg = grid.getCache( ISecurityGrid.class );
if( sg == null )
{
@@ -279,13 +279,13 @@ public class AENetworkProxy implements IGridBlock
public ICraftingGrid getCrafting() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
ICraftingGrid sg = grid.getCache( ICraftingGrid.class );
final ICraftingGrid sg = grid.getCache( ICraftingGrid.class );
if( sg == null )
{
@@ -326,7 +326,7 @@ public class AENetworkProxy implements IGridBlock
}
@Override
public void onGridNotification( GridNotification notification )
public void onGridNotification( final GridNotification notification )
{
if( this.gp instanceof PartCable )
{
@@ -335,7 +335,7 @@ public class AENetworkProxy implements IGridBlock
}
@Override
public void setNetworkStatus( IGrid grid, int channelsInUse )
public void setNetworkStatus( final IGrid grid, final int channelsInUse )
{
}
@@ -364,16 +364,16 @@ public class AENetworkProxy implements IGridBlock
return this.myRepInstance;
}
public void setFlags( GridFlags... requireChannel )
public void setFlags( final GridFlags... requireChannel )
{
EnumSet<GridFlags> flags = EnumSet.noneOf( GridFlags.class );
final EnumSet<GridFlags> flags = EnumSet.noneOf( GridFlags.class );
Collections.addAll( flags, requireChannel );
this.flags = flags;
}
public void setIdlePowerUsage( double idle )
public void setIdlePowerUsage( final double idle )
{
this.idleDraw = idle;
@@ -381,10 +381,10 @@ public class AENetworkProxy implements IGridBlock
{
try
{
IGrid g = this.getGrid();
final IGrid g = this.getGrid();
g.postEvent( new MENetworkPowerIdleChange( this.node ) );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// not ready for this yet..
}
@@ -412,7 +412,7 @@ public class AENetworkProxy implements IGridBlock
{
return this.getEnergy().isNetworkPowered();
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
return false;
}
@@ -420,12 +420,12 @@ public class AENetworkProxy implements IGridBlock
public IEnergyGrid getEnergy() throws GridAccessException
{
IGrid grid = this.getGrid();
final IGrid grid = this.getGrid();
if( grid == null )
{
throw new GridAccessException();
}
IEnergyGrid eg = grid.getCache( IEnergyGrid.class );
final IEnergyGrid eg = grid.getCache( IEnergyGrid.class );
if( eg == null )
{
throw new GridAccessException();
@@ -433,7 +433,7 @@ public class AENetworkProxy implements IGridBlock
return eg;
}
public void setOwner( EntityPlayer player )
public void setOwner( final EntityPlayer player )
{
this.owner = player;
}
@@ -33,7 +33,7 @@ import appeng.util.iterators.ProxyNodeIterator;
public class AENetworkProxyMultiblock extends AENetworkProxy implements IGridMultiblock
{
public AENetworkProxyMultiblock( IGridProxyable te, String nbtName, ItemStack itemStack, boolean inWorld )
public AENetworkProxyMultiblock( final IGridProxyable te, final String nbtName, final ItemStack itemStack, final boolean inWorld )
{
super( te, nbtName, itemStack, inWorld );
}
@@ -31,14 +31,14 @@ public class ChannelPowerSrc implements IEnergySource
final IGridNode node;
final IEnergySource realSrc;
public ChannelPowerSrc( IGridNode networkNode, IEnergySource src )
public ChannelPowerSrc( final IGridNode networkNode, final IEnergySource src )
{
this.node = networkNode;
this.realSrc = src;
}
@Override
public double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier )
public double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier )
{
if( this.node.isActive() )
{
@@ -34,7 +34,7 @@ public class GenericInterestManager<T>
private LinkedList<SavedTransactions> transactions = null;
private int transDepth = 0;
public GenericInterestManager( Multimap<IAEStack, T> interests )
public GenericInterestManager( final Multimap<IAEStack, T> interests )
{
this.container = interests;
}
@@ -55,10 +55,10 @@ public class GenericInterestManager<T>
if( this.transDepth == 0 )
{
LinkedList<SavedTransactions> myActions = this.transactions;
final LinkedList<SavedTransactions> myActions = this.transactions;
this.transactions = null;
for( SavedTransactions t : myActions )
for( final SavedTransactions t : myActions )
{
if( t.put )
{
@@ -72,7 +72,7 @@ public class GenericInterestManager<T>
}
}
public boolean put( IAEStack stack, T iw )
public boolean put( final IAEStack stack, final T iw )
{
if( this.transactions != null )
{
@@ -85,7 +85,7 @@ public class GenericInterestManager<T>
}
}
public boolean remove( IAEStack stack, T iw )
public boolean remove( final IAEStack stack, final T iw )
{
if( this.transactions != null )
{
@@ -98,12 +98,12 @@ public class GenericInterestManager<T>
}
}
public boolean containsKey( IAEStack stack )
public boolean containsKey( final IAEStack stack )
{
return this.container.containsKey( stack );
}
public Collection<T> get( IAEStack stack )
public Collection<T> get( final IAEStack stack )
{
return this.container.get( stack );
}
@@ -115,7 +115,7 @@ public class GenericInterestManager<T>
public final IAEStack stack;
public final T iw;
public SavedTransactions( boolean putOperation, IAEStack myStack, T watcher )
public SavedTransactions( final boolean putOperation, final IAEStack myStack, final T watcher )
{
this.put = putOperation;
this.stack = myStack;
@@ -31,15 +31,15 @@ public class AdHocChannelUpdater implements IGridConnectionVisitor
private final int usedChannels;
public AdHocChannelUpdater( int used )
public AdHocChannelUpdater( final int used )
{
this.usedChannels = used;
}
@Override
public boolean visitNode( IGridNode n )
public boolean visitNode( final IGridNode n )
{
GridNode gn = (GridNode) n;
final GridNode gn = (GridNode) n;
gn.setControllerRoute( null, true );
gn.incrementChannelCount( this.usedChannels );
gn.finalizeChannels();
@@ -47,9 +47,9 @@ public class AdHocChannelUpdater implements IGridConnectionVisitor
}
@Override
public void visitConnection( IGridConnection gcc )
public void visitConnection( final IGridConnection gcc )
{
GridConnection gc = (GridConnection) gcc;
final GridConnection gc = (GridConnection) gcc;
gc.setControllerRoute( null, true );
gc.incrementChannelCount( this.usedChannels );
gc.finalizeChannels();
@@ -30,17 +30,17 @@ public class ControllerChannelUpdater implements IGridConnectionVisitor
{
@Override
public boolean visitNode( IGridNode n )
public boolean visitNode( final IGridNode n )
{
GridNode gn = (GridNode) n;
final GridNode gn = (GridNode) n;
gn.finalizeChannels();
return true;
}
@Override
public void visitConnection( IGridConnection gcc )
public void visitConnection( final IGridConnection gcc )
{
GridConnection gc = (GridConnection) gcc;
final GridConnection gc = (GridConnection) gcc;
gc.finalizeChannels();
}
}
@@ -38,7 +38,7 @@ public class ControllerValidator implements IGridVisitor
int maxY;
int maxZ;
public ControllerValidator( int x, int y, int z )
public ControllerValidator( final int x, final int y, final int z )
{
this.minX = x;
this.maxX = x;
@@ -49,14 +49,14 @@ public class ControllerValidator implements IGridVisitor
}
@Override
public boolean visitNode( IGridNode n )
public boolean visitNode( final IGridNode n )
{
IGridHost host = n.getMachine();
final IGridHost host = n.getMachine();
if( this.isValid && host instanceof TileController )
{
TileController c = (TileController) host;
final TileController c = (TileController) host;
BlockPos pos = c.getPos();
final BlockPos pos = c.getPos();
this.minX = Math.min( pos.getX(), this.minX );
this.maxX = Math.max( pos.getX(), this.maxX );
@@ -40,7 +40,7 @@ public class PathSegment
public boolean isDead;
List<IPathItem> open;
public PathSegment( PathGridCache myPGC, List<IPathItem> open, Set<IPathItem> semiOpen, Set<IPathItem> closed )
public PathSegment( final PathGridCache myPGC, final List<IPathItem> open, final Set<IPathItem> semiOpen, final Set<IPathItem> closed )
{
this.open = open;
this.semiOpen = semiOpen;
@@ -51,14 +51,14 @@ public class PathSegment
public boolean step()
{
List<IPathItem> oldOpen = this.open;
final List<IPathItem> oldOpen = this.open;
this.open = new LinkedList<IPathItem>();
for( IPathItem i : oldOpen )
for( final IPathItem i : oldOpen )
{
for( IPathItem pi : i.getPossibleOptions() )
for( final IPathItem pi : i.getPossibleOptions() )
{
EnumSet<GridFlags> flags = pi.getFlags();
final EnumSet<GridFlags> flags = pi.getFlags();
if( !this.closed.contains( pi ) )
{
@@ -69,7 +69,7 @@ public class PathSegment
// close the semi open.
if( !this.semiOpen.contains( pi ) )
{
boolean worked;
final boolean worked;
if( flags.contains( GridFlags.COMPRESSED_CHANNEL ) )
{
@@ -82,10 +82,10 @@ public class PathSegment
if( worked && flags.contains( GridFlags.MULTIBLOCK ) )
{
Iterator<IGridNode> oni = ( (IGridMultiblock) ( (IGridNode) pi ).getGridBlock() ).getMultiblockNodes();
final Iterator<IGridNode> oni = ( (IGridMultiblock) ( (IGridNode) pi ).getGridBlock() ).getMultiblockNodes();
while( oni.hasNext() )
{
IGridNode otherNodes = oni.next();
final IGridNode otherNodes = oni.next();
if( otherNodes != pi )
{
this.semiOpen.add( (IPathItem) otherNodes );
@@ -109,7 +109,7 @@ public class PathSegment
return this.open.isEmpty();
}
private boolean useDenseChannel( IPathItem start )
private boolean useDenseChannel( final IPathItem start )
{
IPathItem pi = start;
while( pi != null )
@@ -134,7 +134,7 @@ public class PathSegment
return true;
}
private boolean useChannel( IPathItem start )
private boolean useChannel( final IPathItem start )
{
IPathItem pi = start;
while( pi != null )
@@ -36,7 +36,7 @@ public class AEExternalHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource mySrc )
public boolean canHandle( final TileEntity te, final EnumFacing d, final StorageChannel channel, final BaseActionSource mySrc )
{
if( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
{
@@ -47,7 +47,7 @@ public class AEExternalHandler implements IExternalStorageHandler
}
@Override
public IMEInventory getInventory( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource src )
public IMEInventory getInventory( final TileEntity te, final EnumFacing d, final StorageChannel channel, final BaseActionSource src )
{
if( te instanceof TileCondenser )
{
@@ -63,12 +63,12 @@ public class AEExternalHandler implements IExternalStorageHandler
if( te instanceof ITileStorageMonitorable )
{
ITileStorageMonitorable iface = (ITileStorageMonitorable) te;
IStorageMonitorable sm = iface.getMonitorable( d, src );
final ITileStorageMonitorable iface = (ITileStorageMonitorable) te;
final IStorageMonitorable sm = iface.getMonitorable( d, src );
if( channel == StorageChannel.ITEMS && sm != null )
{
IMEInventory<IAEItemStack> ii = sm.getItemInventory();
final IMEInventory<IAEItemStack> ii = sm.getItemInventory();
if( ii != null )
{
return ii;
@@ -77,7 +77,7 @@ public class AEExternalHandler implements IExternalStorageHandler
if( channel == StorageChannel.FLUIDS && sm != null )
{
IMEInventory<IAEFluidStack> fi = sm.getFluidInventory();
final IMEInventory<IAEFluidStack> fi = sm.getFluidInventory();
if( fi != null )
{
return fi;
@@ -67,13 +67,13 @@ public class CellInventory implements ICellInventory
protected ItemStack i;
protected IStorageCell cellType;
protected CellInventory( NBTTagCompound data, ISaveProvider container )
protected CellInventory( final NBTTagCompound data, final ISaveProvider container )
{
this.tagCompound = data;
this.container = container;
}
protected CellInventory( ItemStack o, ISaveProvider container ) throws AppEngException
protected CellInventory( final ItemStack o, final ISaveProvider container ) throws AppEngException
{
if( itemSlots == null )
{
@@ -95,7 +95,7 @@ public class CellInventory implements ICellInventory
this.cellType = null;
this.i = o;
Item type = this.i.getItem();
final Item type = this.i.getItem();
if( type instanceof IStorageCell )
{
this.cellType = (IStorageCell) this.i.getItem();
@@ -128,19 +128,19 @@ public class CellInventory implements ICellInventory
this.cellItems = null;
}
public static IMEInventoryHandler getCell( ItemStack o, ISaveProvider container2 )
public static IMEInventoryHandler getCell( final ItemStack o, final ISaveProvider container2 )
{
try
{
return new CellInventoryHandler( new CellInventory( o, container2 ) );
}
catch( AppEngException e )
catch( final AppEngException e )
{
return null;
}
}
private static boolean isStorageCell( ItemStack i )
private static boolean isStorageCell( final ItemStack i )
{
if( i == null )
{
@@ -149,13 +149,13 @@ public class CellInventory implements ICellInventory
try
{
Item type = i.getItem();
final Item type = i.getItem();
if( type instanceof IStorageCell )
{
return !( (IStorageCell) type ).storableInStorageCell();
}
}
catch( Throwable err )
catch( final Throwable err )
{
return true;
}
@@ -163,14 +163,14 @@ public class CellInventory implements ICellInventory
return false;
}
public static boolean isCell( ItemStack i )
public static boolean isCell( final ItemStack i )
{
if( i == null )
{
return false;
}
Item type = i.getItem();
final Item type = i.getItem();
if( type instanceof IStorageCell )
{
return ( (IStorageCell) type ).isStorageCell( i );
@@ -179,12 +179,12 @@ public class CellInventory implements ICellInventory
return false;
}
public static void addBasicBlackList( int itemID, int meta )
public static void addBasicBlackList( final int itemID, final int meta )
{
BLACK_LIST.add( ( meta << Platform.DEF_OFFSET ) | itemID );
}
public static boolean isBlackListed( IAEItemStack input )
public static boolean isBlackListed( final IAEItemStack input )
{
if( BLACK_LIST.contains( ( OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET ) | Item.getIdFromItem( input.getItem() ) ) )
{
@@ -193,13 +193,13 @@ public class CellInventory implements ICellInventory
return BLACK_LIST.contains( ( input.getItemDamage() << Platform.DEF_OFFSET ) | Item.getIdFromItem( input.getItem() ) );
}
private boolean isEmpty( IMEInventory meInventory )
private boolean isEmpty( final IMEInventory meInventory )
{
return meInventory.getAvailableItems( AEApi.instance().storage().createItemList() ).isEmpty();
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
{
if( input == null )
{
@@ -215,21 +215,21 @@ public class CellInventory implements ICellInventory
return input;
}
ItemStack sharedItemStack = input.getItemStack();
final ItemStack sharedItemStack = input.getItemStack();
if( CellInventory.isStorageCell( sharedItemStack ) )
{
IMEInventory meInventory = getCell( sharedItemStack, null );
final IMEInventory meInventory = getCell( sharedItemStack, null );
if( meInventory != null && !this.isEmpty( meInventory ) )
{
return input;
}
}
IAEItemStack l = this.getCellItems().findPrecise( input );
final IAEItemStack l = this.getCellItems().findPrecise( input );
if( l != null )
{
long remainingItemSlots = this.getRemainingItemCount();
final long remainingItemSlots = this.getRemainingItemCount();
if( remainingItemSlots < 0 )
{
return input;
@@ -237,7 +237,7 @@ public class CellInventory implements ICellInventory
if( input.getStackSize() > remainingItemSlots )
{
IAEItemStack r = input.copy();
final IAEItemStack r = input.copy();
r.setStackSize( r.getStackSize() - remainingItemSlots );
if( mode == Actionable.MODULATE )
{
@@ -261,16 +261,16 @@ public class CellInventory implements ICellInventory
if( this.canHoldNewItem() ) // room for new type, and for at least one item!
{
int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * 8;
final int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * 8;
if( remainingItemCount > 0 )
{
if( input.getStackSize() > remainingItemCount )
{
ItemStack toReturn = Platform.cloneItemStack( sharedItemStack );
final ItemStack toReturn = Platform.cloneItemStack( sharedItemStack );
toReturn.stackSize = sharedItemStack.stackSize - remainingItemCount;
if( mode == Actionable.MODULATE )
{
ItemStack toWrite = Platform.cloneItemStack( sharedItemStack );
final ItemStack toWrite = Platform.cloneItemStack( sharedItemStack );
toWrite.stackSize = remainingItemCount;
this.cellItems.add( AEItemStack.create( toWrite ) );
@@ -296,18 +296,18 @@ public class CellInventory implements ICellInventory
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
if( request == null )
{
return null;
}
long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
final long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
IAEItemStack Results = null;
IAEItemStack l = this.getCellItems().findPrecise( request );
final IAEItemStack l = this.getCellItems().findPrecise( request );
if( l != null )
{
Results = l.copy();
@@ -348,7 +348,7 @@ public class CellInventory implements ICellInventory
return this.cellItems;
}
private void updateItemCount( long delta )
private void updateItemCount( final long delta )
{
this.storedItemCount += delta;
this.tagCompound.setInteger( ITEM_COUNT_TAG, this.storedItemCount );
@@ -361,18 +361,18 @@ public class CellInventory implements ICellInventory
// add new pretty stuff...
int x = 0;
for( IAEItemStack v : this.cellItems )
for( final IAEItemStack v : this.cellItems )
{
itemCount += v.getStackSize();
NBTBase c = this.tagCompound.getTag( itemSlots[x] );
final NBTBase c = this.tagCompound.getTag( itemSlots[x] );
if( c instanceof NBTTagCompound )
{
v.writeToNBT( (NBTTagCompound) c );
}
else
{
NBTTagCompound g = new NBTTagCompound();
final NBTTagCompound g = new NBTTagCompound();
v.writeToNBT( g );
this.tagCompound.setTag( itemSlots[x], g );
}
@@ -388,7 +388,7 @@ public class CellInventory implements ICellInventory
// NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG );
// NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG );
short oldStoredItems = this.storedItems;
final short oldStoredItems = this.storedItems;
/*
* if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size();
@@ -439,11 +439,11 @@ public class CellInventory implements ICellInventory
this.cellItems.resetStatus(); // clears totals and stuff.
int types = (int) this.getStoredItemTypes();
final int types = (int) this.getStoredItemTypes();
for( int x = 0; x < types; x++ )
{
ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( itemSlots[x] ) );
final ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( itemSlots[x] ) );
if( t != null )
{
t.stackSize = this.tagCompound.getInteger( itemSlotCount[x] );
@@ -459,9 +459,9 @@ public class CellInventory implements ICellInventory
}
@Override
public IItemList getAvailableItems( IItemList out )
public IItemList getAvailableItems( final IItemList out )
{
for( IAEItemStack i : this.getCellItems() )
for( final IAEItemStack i : this.getCellItems() )
{
out.add( i );
}
@@ -514,7 +514,7 @@ public class CellInventory implements ICellInventory
@Override
public boolean canHoldNewItem()
{
long bytesFree = this.getFreeBytes();
final long bytesFree = this.getFreeBytes();
return ( bytesFree > this.getBytesPerType() || ( bytesFree == this.getBytesPerType() && this.getUnusedItemCount() > 0 ) ) && this.getRemainingItemTypes() > 0;
}
@@ -533,7 +533,7 @@ public class CellInventory implements ICellInventory
@Override
public long getUsedBytes()
{
long bytesForItemCount = ( this.getStoredItemCount() + this.getUnusedItemCount() ) / 8;
final long bytesForItemCount = ( this.getStoredItemCount() + this.getUnusedItemCount() ) / 8;
return this.getStoredItemTypes() * this.getBytesPerType() + bytesForItemCount;
}
@@ -558,22 +558,22 @@ public class CellInventory implements ICellInventory
@Override
public long getRemainingItemTypes()
{
long basedOnStorage = this.getFreeBytes() / this.getBytesPerType();
long baseOnTotal = this.getTotalItemTypes() - this.getStoredItemTypes();
final long basedOnStorage = this.getFreeBytes() / this.getBytesPerType();
final long baseOnTotal = this.getTotalItemTypes() - this.getStoredItemTypes();
return basedOnStorage > baseOnTotal ? baseOnTotal : basedOnStorage;
}
@Override
public long getRemainingItemCount()
{
long remaining = this.getFreeBytes() * 8 + this.getUnusedItemCount();
final long remaining = this.getFreeBytes() * 8 + this.getUnusedItemCount();
return remaining > 0 ? remaining : 0;
}
@Override
public int getUnusedItemCount()
{
int div = (int) ( this.getStoredItemCount() % 8 );
final int div = (int) ( this.getStoredItemCount() % 8 );
if( div == 0 )
{
@@ -42,28 +42,28 @@ import appeng.util.prioitylist.PrecisePriorityList;
public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> implements ICellInventoryHandler
{
CellInventoryHandler( IMEInventory c )
CellInventoryHandler( final IMEInventory c )
{
super( c, StorageChannel.ITEMS );
ICellInventory ci = this.getCellInv();
final ICellInventory ci = this.getCellInv();
if( ci != null )
{
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
IInventory upgrades = ci.getUpgradesInventory();
IInventory config = ci.getConfigInventory();
FuzzyMode fzMode = ci.getFuzzyMode();
final IInventory upgrades = ci.getUpgradesInventory();
final IInventory config = ci.getConfigInventory();
final FuzzyMode fzMode = ci.getFuzzyMode();
boolean hasInverter = false;
boolean hasFuzzy = false;
for( int x = 0; x < upgrades.getSizeInventory(); x++ )
{
ItemStack is = upgrades.getStackInSlot( x );
final ItemStack is = upgrades.getStackInSlot( x );
if( is != null && is.getItem() instanceof IUpgradeModule )
{
Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
final Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
if( u != null )
{
switch( u )
@@ -82,7 +82,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
for( int x = 0; x < config.getSizeInventory(); x++ )
{
ItemStack is = config.getStackInSlot( x );
final ItemStack is = config.getStackInSlot( x );
if( is != null )
{
priorityList.add( AEItemStack.create( is ) );
@@ -37,29 +37,29 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
final IItemList<IAEItemStack> itemListCache = AEApi.instance().storage().createItemList();
protected CreativeCellInventory( ItemStack o )
protected CreativeCellInventory( final ItemStack o )
{
CellConfig cc = new CellConfig( o );
for( ItemStack is : cc )
final CellConfig cc = new CellConfig( o );
for( final ItemStack is : cc )
{
if( is != null )
{
IAEItemStack i = AEItemStack.create( is );
final IAEItemStack i = AEItemStack.create( is );
i.setStackSize( Integer.MAX_VALUE );
this.itemListCache.add( i );
}
}
}
public static IMEInventoryHandler getCell( ItemStack o )
public static IMEInventoryHandler getCell( final ItemStack o )
{
return new CellInventoryHandler( new CreativeCellInventory( o ) );
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
{
IAEItemStack local = this.itemListCache.findPrecise( input );
final IAEItemStack local = this.itemListCache.findPrecise( input );
if( local == null )
{
return input;
@@ -69,9 +69,9 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
IAEItemStack local = this.itemListCache.findPrecise( request );
final IAEItemStack local = this.itemListCache.findPrecise( request );
if( local == null )
{
return null;
@@ -81,9 +81,9 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
for( IAEItemStack ais : this.itemListCache )
for( final IAEItemStack ais : this.itemListCache )
{
out.add( ais );
}
@@ -103,13 +103,13 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return this.itemListCache.findPrecise( input ) != null;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
return this.itemListCache.findPrecise( input ) != null;
}
@@ -127,7 +127,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -36,7 +36,7 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
final ICellHandler handler;
final IChestOrDrive cord;
public DriveWatcher( IMEInventory<T> i, ItemStack is, ICellHandler han, IChestOrDrive cod )
public DriveWatcher( final IMEInventory<T> i, final ItemStack is, final ICellHandler han, final IChestOrDrive cod )
{
super( i, i.getChannel() );
this.is = is;
@@ -45,15 +45,15 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( final T input, final Actionable type, final BaseActionSource src )
{
long size = input.getStackSize();
final long size = input.getStackSize();
T a = super.injectItems( input, type, src );
final T a = super.injectItems( input, type, src );
if( a == null || a.getStackSize() != size )
{
int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
final int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
if( newStatus != this.oldStatus )
{
@@ -65,13 +65,13 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
}
@Override
public T extractItems( T request, Actionable type, BaseActionSource src )
public T extractItems( final T request, final Actionable type, final BaseActionSource src )
{
T a = super.extractItems( request, type, src );
final T a = super.extractItems( request, type, src );
if( a != null )
{
int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
final int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
if( newStatus != this.oldStatus )
{
@@ -39,7 +39,7 @@ public class ItemWatcher implements IStackWatcher
final IStackWatcherHost myObject;
final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
public ItemWatcher( GridStorageCache cache, IStackWatcherHost host )
public ItemWatcher( final GridStorageCache cache, final IStackWatcherHost host )
{
this.gsc = cache;
this.myObject = host;
@@ -63,7 +63,7 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean contains( Object o )
public boolean contains( final Object o )
{
return this.myInterests.contains( o );
}
@@ -81,13 +81,13 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public <T> T[] toArray( T[] a )
public <T> T[] toArray( final T[] a )
{
return this.myInterests.toArray( a );
}
@Override
public boolean add( IAEStack e )
public boolean add( final IAEStack e )
{
if( this.myInterests.contains( e ) )
{
@@ -98,23 +98,23 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean remove( Object o )
public boolean remove( final Object o )
{
return this.myInterests.remove( o ) && this.gsc.interestManager.remove( (IAEStack) o, this );
}
@Override
public boolean containsAll( Collection<?> c )
public boolean containsAll( final Collection<?> c )
{
return this.myInterests.containsAll( c );
}
@Override
public boolean addAll( Collection<? extends IAEStack> c )
public boolean addAll( final Collection<? extends IAEStack> c )
{
boolean didChange = false;
for( IAEStack o : c )
for( final IAEStack o : c )
{
didChange = this.add( o ) || didChange;
}
@@ -123,10 +123,10 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean removeAll( Collection<?> c )
public boolean removeAll( final Collection<?> c )
{
boolean didSomething = false;
for( Object o : c )
for( final Object o : c )
{
didSomething = this.remove( o ) || didSomething;
}
@@ -134,10 +134,10 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean retainAll( Collection<?> c )
public boolean retainAll( final Collection<?> c )
{
boolean changed = false;
Iterator<IAEStack> i = this.iterator();
final Iterator<IAEStack> i = this.iterator();
while( i.hasNext() )
{
@@ -154,7 +154,7 @@ public class ItemWatcher implements IStackWatcher
@Override
public void clear()
{
Iterator<IAEStack> i = this.myInterests.iterator();
final Iterator<IAEStack> i = this.myInterests.iterator();
while( i.hasNext() )
{
this.gsc.interestManager.remove( i.next(), this );
@@ -169,7 +169,7 @@ public class ItemWatcher implements IStackWatcher
final Iterator<IAEStack> interestIterator;
IAEStack myLast;
public ItemWatcherIterator( ItemWatcher parent, Iterator<IAEStack> i )
public ItemWatcherIterator( final ItemWatcher parent, final Iterator<IAEStack> i )
{
this.watcher = parent;
this.interestIterator = i;
@@ -38,20 +38,20 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
protected final IInventory target;
protected final InventoryAdaptor adaptor;
public MEIInventoryWrapper( IInventory m, InventoryAdaptor ia )
public MEIInventoryWrapper( final IInventory m, final InventoryAdaptor ia )
{
this.target = m;
this.adaptor = ia;
}
@Override
public IAEItemStack injectItems( IAEItemStack iox, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack iox, final Actionable mode, final BaseActionSource src )
{
ItemStack input = iox.getItemStack();
final ItemStack input = iox.getItemStack();
if( this.adaptor != null )
{
ItemStack is = mode == Actionable.SIMULATE ? this.adaptor.simulateAdd( input ) : this.adaptor.addItems( input );
final ItemStack is = mode == Actionable.SIMULATE ? this.adaptor.simulateAdd( input ) : this.adaptor.addItems( input );
if( is == null )
{
return null;
@@ -59,17 +59,17 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
return AEItemStack.create( is );
}
ItemStack out = Platform.cloneItemStack( input );
final ItemStack out = Platform.cloneItemStack( input );
if( mode == Actionable.MODULATE ) // absolutely no need for a first run in simulate mode.
{
for( int x = 0; x < this.target.getSizeInventory(); x++ )
{
ItemStack t = this.target.getStackInSlot( x );
final ItemStack t = this.target.getStackInSlot( x );
if( Platform.isSameItem( t, input ) )
{
int oriStack = t.stackSize;
final int oriStack = t.stackSize;
t.stackSize += out.stackSize;
this.target.setInventorySlotContents( x, t );
@@ -125,9 +125,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
ItemStack Req = request.getItemStack();
final ItemStack Req = request.getItemStack();
int request_stackSize = Req.stackSize;
@@ -151,7 +151,7 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
// try to find matching inventories that already have it...
for( int x = 0; x < this.target.getSizeInventory(); x++ )
{
ItemStack sub = this.target.getStackInSlot( x );
final ItemStack sub = this.target.getStackInSlot( x );
if( Platform.isSameItem( sub, Req ) )
{
@@ -206,7 +206,7 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
{
for( int x = 0; x < this.target.getSizeInventory(); x++ )
{
@@ -48,7 +48,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
private boolean hasReadAccess;
private boolean hasWriteAccess;
public MEInventoryHandler( IMEInventory<T> i, StorageChannel channel )
public MEInventoryHandler( final IMEInventory<T> i, final StorageChannel channel )
{
this.channel = channel;
@@ -74,7 +74,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myWhitelist;
}
public void setWhitelist( IncludeExclude myWhitelist )
public void setWhitelist( final IncludeExclude myWhitelist )
{
this.myWhitelist = myWhitelist;
}
@@ -84,7 +84,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myAccess;
}
public void setBaseAccess( AccessRestriction myAccess )
public void setBaseAccess( final AccessRestriction myAccess )
{
this.myAccess = myAccess;
this.cachedAccessRestriction = this.myAccess.restrictPermissions( this.internal.getAccess() );
@@ -97,13 +97,13 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myPartitionList;
}
public void setPartitionList( IPartitionList<T> myPartitionList )
public void setPartitionList( final IPartitionList<T> myPartitionList )
{
this.myPartitionList = myPartitionList;
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( final T input, final Actionable type, final BaseActionSource src )
{
if( !this.canAccept( input ) )
{
@@ -114,7 +114,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public T extractItems( T request, Actionable type, BaseActionSource src )
public T extractItems( final T request, final Actionable type, final BaseActionSource src )
{
if( !this.hasReadAccess )
{
@@ -125,7 +125,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public IItemList<T> getAvailableItems( IItemList<T> out )
public IItemList<T> getAvailableItems( final IItemList<T> out )
{
if( !this.hasReadAccess )
{
@@ -148,7 +148,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
if( this.myWhitelist == IncludeExclude.WHITELIST )
{
@@ -158,7 +158,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
if( !this.hasWriteAccess )
{
@@ -182,7 +182,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myPriority;
}
public void setPriority( int myPriority )
public void setPriority( final int myPriority )
{
this.myPriority = myPriority;
}
@@ -194,7 +194,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -53,26 +53,26 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
public BaseActionSource mySource;
public StorageFilter mode = StorageFilter.EXTRACTABLE_ONLY;
public MEMonitorIInventory( InventoryAdaptor adaptor )
public MEMonitorIInventory( final InventoryAdaptor adaptor )
{
this.adaptor = adaptor;
this.memory = new ConcurrentSkipListMap<Integer, CachedItemStack>();
}
@Override
public void addListener( IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken )
public void addListener( final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken )
{
this.listeners.put( l, verificationToken );
}
@Override
public void removeListener( IMEMonitorHandlerReceiver<IAEItemStack> l )
public void removeListener( final IMEMonitorHandlerReceiver<IAEItemStack> l )
{
this.listeners.remove( l );
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
{
ItemStack out = null;
@@ -96,13 +96,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
// better then doing construction from scratch :3
IAEItemStack o = input.copy();
final IAEItemStack o = input.copy();
o.setStackSize( out.stackSize );
return o;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable type, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable type, final BaseActionSource src )
{
ItemStack out = null;
@@ -121,7 +121,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
// better then doing construction from scratch :3
IAEItemStack o = request.copy();
final IAEItemStack o = request.copy();
o.setStackSize( out.stackSize );
if( type == Actionable.MODULATE )
@@ -141,22 +141,22 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
public TickRateModulation onTick()
{
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
final LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
this.list.resetStatus();
int high = 0;
boolean changed = false;
for( ItemSlot is : this.adaptor )
for( final ItemSlot is : this.adaptor )
{
CachedItemStack old = this.memory.get( is.slot );
final CachedItemStack old = this.memory.get( is.slot );
high = Math.max( high, is.slot );
ItemStack newIS = !is.isExtractable && this.mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
ItemStack oldIS = old == null ? null : old.itemStack;
final ItemStack newIS = !is.isExtractable && this.mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
final ItemStack oldIS = old == null ? null : old.itemStack;
if( this.isDifferent( newIS, oldIS ) )
{
CachedItemStack cis = new CachedItemStack( is.getItemStack() );
final CachedItemStack cis = new CachedItemStack( is.getItemStack() );
this.memory.put( is.slot, cis );
if( old != null && old.aeStack != null )
@@ -175,10 +175,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
else
{
int newSize = ( newIS == null ? 0 : newIS.stackSize );
int diff = newSize - ( oldIS == null ? 0 : oldIS.stackSize );
final int newSize = ( newIS == null ? 0 : newIS.stackSize );
final int diff = newSize - ( oldIS == null ? 0 : oldIS.stackSize );
IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() );
final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() );
if( stack != null )
{
stack.setStackSize( newSize );
@@ -187,10 +187,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
if( diff != 0 && stack != null )
{
CachedItemStack cis = new CachedItemStack( is.getItemStack() );
final CachedItemStack cis = new CachedItemStack( is.getItemStack() );
this.memory.put( is.slot, cis );
IAEItemStack a = stack.copy();
final IAEItemStack a = stack.copy();
a.setStackSize( diff );
changes.add( a );
changed = true;
@@ -199,14 +199,14 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
// detect dropped items; should fix non IISided Inventory Changes.
NavigableMap<Integer, CachedItemStack> end = this.memory.tailMap( high, false );
final NavigableMap<Integer, CachedItemStack> end = this.memory.tailMap( high, false );
if( !end.isEmpty() )
{
for( CachedItemStack cis : end.values() )
for( final CachedItemStack cis : end.values() )
{
if( cis != null && cis.aeStack != null )
{
IAEItemStack a = cis.aeStack.copy();
final IAEItemStack a = cis.aeStack.copy();
a.setStackSize( -a.getStackSize() );
changes.add( a );
changed = true;
@@ -223,7 +223,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
}
private boolean isDifferent( ItemStack a, ItemStack b )
private boolean isDifferent( final ItemStack a, final ItemStack b )
{
if( a == b && b == null )
{
@@ -238,16 +238,16 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
return !Platform.isSameItemPrecise( a, b );
}
private void postDifference( Iterable<IAEItemStack> a )
private void postDifference( final Iterable<IAEItemStack> a )
{
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
if( a != null )
{
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.listeners.entrySet().iterator();
final Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.listeners.entrySet().iterator();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> l = i.next();
IMEMonitorHandlerReceiver<IAEItemStack> key = l.getKey();
final Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> l = i.next();
final IMEMonitorHandlerReceiver<IAEItemStack> key = l.getKey();
if( key.isValid( l.getValue() ) )
{
key.postChange( this, a, this.mySource );
@@ -267,13 +267,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return false;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
return true;
}
@@ -291,15 +291,15 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
for( CachedItemStack is : this.memory.values() )
for( final CachedItemStack is : this.memory.values() )
{
out.addStorage( is.aeStack );
}
@@ -319,7 +319,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
final ItemStack itemStack;
final IAEItemStack aeStack;
public CachedItemStack( ItemStack is )
public CachedItemStack( final ItemStack is )
{
if( is == null )
{
@@ -42,7 +42,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
public BaseActionSource changeSource;
IMEMonitor<T> monitor;
public MEMonitorPassThrough( IMEInventory<T> i, StorageChannel channel )
public MEMonitorPassThrough( final IMEInventory<T> i, final StorageChannel channel )
{
super( i, channel );
if( i instanceof IMEMonitor )
@@ -52,7 +52,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
@Override
public void setInternal( IMEInventory<T> i )
public void setInternal( final IMEInventory<T> i )
{
if( this.monitor != null )
{
@@ -60,7 +60,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
this.monitor = null;
IItemList<T> before = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
final IItemList<T> before = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
super.setInternal( i );
if( i instanceof IMEMonitor )
@@ -68,7 +68,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
this.monitor = (IMEMonitor<T>) i;
}
IItemList<T> after = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
final IItemList<T> after = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
if( this.monitor != null )
{
@@ -79,20 +79,20 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
@Override
public IItemList<T> getAvailableItems( IItemList out )
public IItemList<T> getAvailableItems( final IItemList out )
{
super.getAvailableItems( new ItemListIgnoreCrafting( out ) );
return out;
}
@Override
public void addListener( IMEMonitorHandlerReceiver<T> l, Object verificationToken )
public void addListener( final IMEMonitorHandlerReceiver<T> l, final Object verificationToken )
{
this.listeners.put( l, verificationToken );
}
@Override
public void removeListener( IMEMonitorHandlerReceiver<T> l )
public void removeListener( final IMEMonitorHandlerReceiver<T> l )
{
this.listeners.remove( l );
}
@@ -102,7 +102,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
{
if( this.monitor == null )
{
IItemList<T> out = this.channel.createList();
final IItemList<T> out = this.channel.createList();
this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) );
return out;
}
@@ -110,19 +110,19 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
@Override
public boolean isValid( Object verificationToken )
public boolean isValid( final Object verificationToken )
{
return verificationToken == this.monitor;
}
@Override
public void postChange( IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source )
public void postChange( final IBaseMonitor<T> monitor, final Iterable<T> change, final BaseActionSource source )
{
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
IMEMonitorHandlerReceiver<T> receiver = e.getKey();
final Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
final IMEMonitorHandlerReceiver<T> receiver = e.getKey();
if( receiver.isValid( e.getValue() ) )
{
receiver.postChange( this, change, source );
@@ -137,11 +137,11 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
@Override
public void onListUpdate()
{
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
IMEMonitorHandlerReceiver<T> receiver = e.getKey();
final Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
final IMEMonitorHandlerReceiver<T> receiver = e.getKey();
if( receiver.isValid( e.getValue() ) )
{
receiver.onListUpdate();
@@ -35,7 +35,7 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
protected final StorageChannel channel;
private IMEInventory<T> internal;
public MEPassThrough( IMEInventory<T> i, StorageChannel channel )
public MEPassThrough( final IMEInventory<T> i, final StorageChannel channel )
{
this.channel = channel;
this.setInternal( i );
@@ -46,25 +46,25 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
return this.internal;
}
public void setInternal( IMEInventory<T> i )
public void setInternal( final IMEInventory<T> i )
{
this.internal = i;
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( final T input, final Actionable type, final BaseActionSource src )
{
return this.internal.injectItems( input, type, src );
}
@Override
public T extractItems( T request, Actionable type, BaseActionSource src )
public T extractItems( final T request, final Actionable type, final BaseActionSource src )
{
return this.internal.extractItems( request, type, src );
}
@Override
public IItemList<T> getAvailableItems( IItemList out )
public IItemList<T> getAvailableItems( final IItemList out )
{
return this.internal.getAvailableItems( out );
}
@@ -82,13 +82,13 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
return false;
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
return true;
}
@@ -106,7 +106,7 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -53,7 +53,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
{
@Override
public int compare( Integer o1, Integer o2 )
public int compare( final Integer o1, final Integer o2 )
{
return ItemSorters.compareInt( o2, o1 );
}
@@ -65,16 +65,16 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> priorityInventory;
int myPass = 0;
public NetworkInventoryHandler( StorageChannel chan, SecurityCache security )
public NetworkInventoryHandler( final StorageChannel chan, final SecurityCache security )
{
this.myChannel = chan;
this.security = security;
this.priorityInventory = new TreeMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
}
public void addNewStorage( IMEInventoryHandler<T> h )
public void addNewStorage( final IMEInventoryHandler<T> h )
{
int priority = h.getPriority();
final int priority = h.getPriority();
List<IMEInventoryHandler<T>> list = this.priorityInventory.get( priority );
if( list == null )
{
@@ -85,7 +85,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( T input, final Actionable type, final BaseActionSource src )
{
if( this.diveList( this, type ) )
{
@@ -98,12 +98,12 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return input;
}
for( List<IMEInventoryHandler<T>> invList : this.priorityInventory.values() )
for( final List<IMEInventoryHandler<T>> invList : this.priorityInventory.values() )
{
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
while( ii.hasNext() && input != null )
{
IMEInventoryHandler<T> inv = ii.next();
final IMEInventoryHandler<T> inv = ii.next();
if( inv.validForPass( 1 ) && inv.canAccept( input ) && ( inv.isPrioritized( input ) || inv.extractItems( input, Actionable.SIMULATE, src ) != null ) )
{
@@ -118,7 +118,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
ii = invList.iterator();
while( ii.hasNext() && input != null )
{
IMEInventoryHandler<T> inv = ii.next();
final IMEInventoryHandler<T> inv = ii.next();
if( inv.validForPass( 2 ) && inv.canAccept( input ) && !inv.isPrioritized( input ) )
{
@@ -132,9 +132,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return input;
}
private boolean diveList( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
private boolean diveList( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
LinkedList cDepth = this.getDepth( type );
final LinkedList cDepth = this.getDepth( type );
if( cDepth.contains( networkInventoryHandler ) )
{
return true;
@@ -144,7 +144,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return false;
}
private boolean testPermission( BaseActionSource src, SecurityPermissions permission )
private boolean testPermission( final BaseActionSource src, final SecurityPermissions permission )
{
if( src.isPlayer() )
{
@@ -157,18 +157,18 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
{
if( this.security.isAvailable() )
{
IGridNode n = ( (MachineSource) src ).via.getActionableNode();
final IGridNode n = ( (MachineSource) src ).via.getActionableNode();
if( n == null )
{
return true;
}
IGrid gn = n.getGrid();
final IGrid gn = n.getGrid();
if( gn != this.security.myGrid )
{
ISecurityGrid sg = gn.getCache( ISecurityGrid.class );
int playerID = sg.getOwner();
final ISecurityGrid sg = gn.getCache( ISecurityGrid.class );
final int playerID = sg.getOwner();
if( !this.security.hasPermission( playerID, permission ) )
{
@@ -181,7 +181,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return false;
}
private void surface( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
private void surface( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
if( this.getDepth( type ).pop() != this )
{
@@ -189,9 +189,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
}
private LinkedList getDepth( Actionable type )
private LinkedList getDepth( final Actionable type )
{
ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
final ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
LinkedList s = depth.get();
@@ -204,7 +204,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public T extractItems( T request, Actionable mode, BaseActionSource src )
public T extractItems( T request, final Actionable mode, final BaseActionSource src )
{
if( this.diveList( this, mode ) )
{
@@ -217,21 +217,21 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return null;
}
Iterator<List<IMEInventoryHandler<T>>> i = this.priorityInventory.descendingMap().values().iterator();// priorityInventory.asMap().descendingMap().entrySet().iterator();
final Iterator<List<IMEInventoryHandler<T>>> i = this.priorityInventory.descendingMap().values().iterator();// priorityInventory.asMap().descendingMap().entrySet().iterator();
T output = request.copy();
final T output = request.copy();
request = request.copy();
output.setStackSize( 0 );
long req = request.getStackSize();
final long req = request.getStackSize();
while( i.hasNext() )
{
List<IMEInventoryHandler<T>> invList = i.next();
final List<IMEInventoryHandler<T>> invList = i.next();
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
final Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
while( ii.hasNext() && output.getStackSize() < req )
{
IMEInventoryHandler<T> inv = ii.next();
final IMEInventoryHandler<T> inv = ii.next();
request.setStackSize( req - output.getStackSize() );
output.add( inv.extractItems( request, mode, src ) );
@@ -257,9 +257,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
// for (Entry<Integer, IMEInventoryHandler<T>> h : priorityInventory.entries())
for( List<IMEInventoryHandler<T>> i : this.priorityInventory.values() )
for( final List<IMEInventoryHandler<T>> i : this.priorityInventory.values() )
{
for( IMEInventoryHandler<T> j : i )
for( final IMEInventoryHandler<T> j : i )
{
out = j.getAvailableItems( out );
}
@@ -270,9 +270,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return out;
}
private boolean diveIteration( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
private boolean diveIteration( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
LinkedList cDepth = this.getDepth( type );
final LinkedList cDepth = this.getDepth( type );
if( cDepth.isEmpty() )
{
currentPass++;
@@ -307,13 +307,13 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
return false;
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
return true;
}
@@ -331,7 +331,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -32,19 +32,19 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
{
@Override
public T injectItems( T input, Actionable mode, BaseActionSource src )
public T injectItems( final T input, final Actionable mode, final BaseActionSource src )
{
return input;
}
@Override
public T extractItems( T request, Actionable mode, BaseActionSource src )
public T extractItems( final T request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<T> getAvailableItems( IItemList out )
public IItemList<T> getAvailableItems( final IItemList out )
{
return out;
}
@@ -62,13 +62,13 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
return false;
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
return false;
}
@@ -86,7 +86,7 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 2;
}
@@ -42,13 +42,13 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
public final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().createItemList();
final TileSecurity securityTile;
public SecurityInventory( TileSecurity ts )
public SecurityInventory( final TileSecurity ts )
{
this.securityTile = ts;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
{
if( this.hasPermission( src ) )
{
@@ -70,7 +70,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
return input;
}
private boolean hasPermission( BaseActionSource src )
private boolean hasPermission( final BaseActionSource src )
{
if( src.isPlayer() )
{
@@ -78,7 +78,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
{
return this.securityTile.getProxy().getSecurity().hasPermission( ( (PlayerSource) src ).player, SecurityPermissions.SECURITY );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -87,14 +87,14 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
if( this.hasPermission( src ) )
{
IAEItemStack target = this.storedItems.findPrecise( request );
final IAEItemStack target = this.storedItems.findPrecise( request );
if( target != null )
{
IAEItemStack output = target.copy();
final IAEItemStack output = target.copy();
if( mode == Actionable.SIMULATE )
{
@@ -110,9 +110,9 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
for( IAEItemStack ais : this.storedItems )
for( final IAEItemStack ais : this.storedItems )
{
out.add( ais );
}
@@ -133,30 +133,30 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return false;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
if( input.getItem() instanceof IBiometricCard )
{
IBiometricCard tbc = (IBiometricCard) input.getItem();
GameProfile newUser = tbc.getProfile( input.getItemStack() );
final IBiometricCard tbc = (IBiometricCard) input.getItem();
final GameProfile newUser = tbc.getProfile( input.getItemStack() );
int PlayerID = AEApi.instance().registries().players().getID( newUser );
final int PlayerID = AEApi.instance().registries().players().getID( newUser );
if( this.securityTile.getOwner() == PlayerID )
{
return false;
}
for( IAEItemStack ais : this.storedItems )
for( final IAEItemStack ais : this.storedItems )
{
if( ais.isMeaningful() )
{
GameProfile thisUser = tbc.getProfile( ais.getItemStack() );
final GameProfile thisUser = tbc.getProfile( ais.getItemStack() );
if( thisUser == newUser )
{
return false;
@@ -187,7 +187,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -34,13 +34,13 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
final TileCondenser target;
public VoidFluidInventory( TileCondenser te )
public VoidFluidInventory( final TileCondenser te )
{
this.target = te;
}
@Override
public IAEFluidStack injectItems( IAEFluidStack input, Actionable mode, BaseActionSource src )
public IAEFluidStack injectItems( final IAEFluidStack input, final Actionable mode, final BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
@@ -55,13 +55,13 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
}
@Override
public IAEFluidStack extractItems( IAEFluidStack request, Actionable mode, BaseActionSource src )
public IAEFluidStack extractItems( final IAEFluidStack request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<IAEFluidStack> getAvailableItems( IItemList out )
public IItemList<IAEFluidStack> getAvailableItems( final IItemList out )
{
return out;
}
@@ -79,13 +79,13 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
}
@Override
public boolean isPrioritized( IAEFluidStack input )
public boolean isPrioritized( final IAEFluidStack input )
{
return false;
}
@Override
public boolean canAccept( IAEFluidStack input )
public boolean canAccept( final IAEFluidStack input )
{
return true;
}
@@ -103,7 +103,7 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 2;
}
@@ -34,13 +34,13 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
final TileCondenser target;
public VoidItemInventory( TileCondenser te )
public VoidItemInventory( final TileCondenser te )
{
this.target = te;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
@@ -55,13 +55,13 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
return out;
}
@@ -79,13 +79,13 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return false;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
return true;
}
@@ -103,7 +103,7 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 2;
}