Reduce scope of variables

This commit is contained in:
thatsIch
2015-09-25 22:52:41 +02:00
parent f4ff28d2a6
commit 0387d30d1c
78 changed files with 174 additions and 218 deletions
+1 -1
View File
@@ -308,9 +308,9 @@ public class PathGridCache implements IPathingGrid
private int calculateRequiredChannels()
{
int depth = 0;
this.semiOpen.clear();
int depth = 0;
for( IGridNode nodes : this.requireChannels )
{
if( !this.semiOpen.contains( nodes ) )
+6 -11
View File
@@ -64,13 +64,6 @@ public class SpatialPylonCache implements ISpatialCache
public void reset( IGrid grid )
{
int reqX = 0;
int reqY = 0;
int reqZ = 0;
int requirePylonBlocks = 1;
double minPower = 0;
double maxPower = 0;
this.clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>();
this.ioPorts = new LinkedList<TileSpatialIOPort>();
@@ -120,6 +113,8 @@ public class SpatialPylonCache implements ISpatialCache
this.captureMax.z = Math.max( this.captureMax.z, cl.max.z );
}
double maxPower = 0;
double minPower = 0;
if( this.hasRegion() )
{
this.isValid = this.captureMax.x - this.captureMin.x > 1 && this.captureMax.y - this.captureMin.y > 1 && this.captureMax.z - this.captureMin.z > 1;
@@ -149,10 +144,10 @@ public class SpatialPylonCache implements ISpatialCache
}
}
reqX = this.captureMax.x - this.captureMin.x;
reqY = this.captureMax.y - this.captureMin.y;
reqZ = this.captureMax.z - this.captureMin.z;
requirePylonBlocks = Math.max( 6, ( ( reqX * reqZ + reqX * reqY + reqY * reqZ ) * 3 ) / 8 );
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 );
this.efficiency = (double) pylonBlocks / (double) requirePylonBlocks;
@@ -1292,12 +1292,12 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.lastTime = System.nanoTime();
this.elapsedTime = 0;
int itemCount = 0;
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
this.getListOfItem( list, CraftingItemList.ACTIVE );
this.getListOfItem( list, CraftingItemList.PENDING );
int itemCount = 0;
for( IAEItemStack ge : list )
{
itemCount += ge.getStackSize();
@@ -128,9 +128,8 @@ public class QuantumCalculator extends MBCalculator
{
TileQuantumBridge te = (TileQuantumBridge) w.getTileEntity( x, y, z );
byte flags;
num++;
byte flags;
if( num == 5 )
{
flags = num;
@@ -79,9 +79,8 @@ public class QuantumCluster implements ILocatable, IAECluster
@Override
public void updateStatus( boolean updateGrid )
{
long qe;
qe = this.center.getQEFrequency();
long qe = this.center.getQEFrequency();
if( this.thisSide != qe && this.thisSide != -qe )
{
@@ -128,7 +128,6 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
{
ItemStack Gathered = null;
ItemStack Req = request.getItemStack();
int request_stackSize = Req.stackSize;
@@ -140,6 +139,7 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
Req.stackSize = request_stackSize;
ItemStack Gathered = null;
if( this.adaptor != null )
{
Gathered = this.adaptor.removeItems( Req.stackSize, Req, null );
@@ -141,12 +141,12 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
public TickRateModulation onTick()
{
boolean changed = false;
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
int high = 0;
this.list.resetStatus();
int high = 0;
boolean changed = false;
for( ItemSlot is : this.adaptor )
{
CachedItemStack old = this.memory.get( is.slot );
@@ -168,10 +168,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
IGrid gn = n.getGrid();
if( gn != this.security.myGrid )
{
int playerID = -1;
ISecurityGrid sg = gn.getCache( ISecurityGrid.class );
playerID = sg.getOwner();
int playerID = sg.getOwner();
if( !this.security.hasPermission( playerID, permission ) )
{